@@ -33,7 +33,7 @@ class Storage<T> {
33
33
public get = async ( ) :Promise < T > => {
34
34
if ( SESSION_STORAGE_PATH ) {
35
35
try {
36
- // 1. read from file instead of local storage if specified
36
+ // 1.attempt to read from file instead of local storage if specified
37
37
const sessionFile = await readFile ( SESSION_STORAGE_PATH , `${ this . filePath } .json` )
38
38
if ( ! sessionFile ) {
39
39
throw new Error ( 'No session file found' )
@@ -50,14 +50,15 @@ class Storage<T> {
50
50
} catch ( err :any ) {
51
51
logger ( `Failed to read or parse session file:${ SESSION_STORAGE_PATH } /${ this . filePath } .json:${ err . message } ` )
52
52
}
53
- }
54
- const value :string | undefined = await this . storage . get ( this . key )
55
- if ( value ) {
56
- // 2. read from local storage
57
- try {
58
- return JSON . parse ( value )
59
- } catch ( err :any ) {
60
- logger ( `Failed to parse session state from local storage:${ value } :${ err . message } ` )
53
+ } else {
54
+ // 2. attempt to read from local storage
55
+ const value :string | undefined = await this . storage . get ( this . key )
56
+ if ( value ) {
57
+ try {
58
+ return JSON . parse ( value )
59
+ } catch ( err :any ) {
60
+ logger ( `Failed to parse session state from local storage:${ value } :${ err . message } ` )
61
+ }
61
62
}
62
63
}
63
64
// 3. fallback to the default