File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,19 @@ export class LocalSessionConfigRepository extends ISessionConfigRepository {
1414 this . store = store ;
1515 }
1616
17- async get ( sessionName : string ) : Promise < SessionConfig | null > {
18- const filepath = this . getFilePath ( sessionName ) ;
19- // Check file exists
17+ private async fileExists ( filepath : string ) {
2018 try {
2119 await fs . access ( filepath , fs . constants . F_OK ) ;
2220 } catch ( error ) {
21+ return false ;
22+ }
23+ return true ;
24+ }
25+
26+ async get ( sessionName : string ) : Promise < SessionConfig | null > {
27+ const filepath = this . getFilePath ( sessionName ) ;
28+ // Check file exists
29+ if ( ! ( await this . fileExists ( filepath ) ) ) {
2330 return null ;
2431 }
2532
@@ -51,6 +58,9 @@ export class LocalSessionConfigRepository extends ISessionConfigRepository {
5158
5259 async delete ( sessionName : string ) : Promise < void > {
5360 const filepath = this . getFilePath ( sessionName ) ;
61+ if ( ! ( await this . fileExists ( filepath ) ) ) {
62+ return ;
63+ }
5464 await fs . unlink ( filepath ) ;
5565 }
5666}
You can’t perform that action at this time.
0 commit comments