File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -49,14 +49,15 @@ class Application extends events.EventEmitter {
4949 }
5050
5151 async createScript ( fileName ) {
52- const code = await fsp . readFile ( fileName , 'utf8' ) ;
53- const src = '\'use strict\';\ncontext => ' + code ;
54- const options = { filename : fileName , lineOffset : - 1 } ;
5552 try {
53+ const code = await fsp . readFile ( fileName , 'utf8' ) ;
54+ if ( ! code ) return null ;
55+ const src = '\'use strict\';\ncontext => ' + code ;
56+ const options = { filename : fileName , lineOffset : - 1 } ;
5657 const script = new vm . Script ( src , options ) ;
5758 return script . runInContext ( this . sandbox , SCRIPT_OPTIONS ) ;
5859 } catch ( err ) {
59- this . logger . error ( err . stack ) ;
60+ if ( err . code !== 'ENOENT' ) this . logger . error ( err . stack ) ;
6061 return null ;
6162 }
6263 }
@@ -74,8 +75,7 @@ class Application extends events.EventEmitter {
7475 const data = await fsp . readFile ( filePath ) ;
7576 this . static . set ( key , data ) ;
7677 } catch ( err ) {
77- this . logger . error ( err . stack ) ;
78- if ( err . code !== 'ENOENT' ) throw err ;
78+ if ( err . code !== 'ENOENT' ) this . logger . error ( err . stack ) ;
7979 }
8080 }
8181
You can’t perform that action at this time.
0 commit comments