File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
packages/node/src/adapter Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ export class SyncAdapter<T> extends BaseAdapter<T> {
1313 this . data = this . dataTransformer . toJSON ( file )
1414 this . logger ?. info ( 'Read data from file' , this . data )
1515 } catch ( err ) {
16- this . data = null
1716 if ( ( err as NodeJS . ErrnoException ) . code !== 'ENOENT' ) {
1817 this . logger ?. error ( 'Failed to read data from file' , err )
1918 }
@@ -31,18 +30,14 @@ export class SyncAdapter<T> extends BaseAdapter<T> {
3130 return
3231 }
3332
34- try {
33+ if ( this . data ) {
3534 this . directory
3635 . writerTemporaryFile ( this . fileName )
3736 . write ( this . dataTransformer . toString ( this . data ) )
38-
39- this . data = this . dataTransformer . toJSON ( this . initialData )
40- this . write ( )
41- } catch ( err ) {
42- if ( ( err as NodeJS . ErrnoException ) . code !== 'ENOENT' ) {
43- this . logger ?. error ( 'Failed to read data from file' , err )
44- }
4537 }
38+
39+ this . data = this . dataTransformer . toJSON ( this . initialData )
40+ this . write ( )
4641 }
4742
4843 exists ( ) : boolean {
You can’t perform that action at this time.
0 commit comments