File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {deleteAsync} from 'del';
1010import path from 'node:path' ;
1111// import this app's useful class.
1212import FS from "../Libraries/FS.mjs" ;
13+ import TextStyles from "../Libraries/TextStyles.mjs" ;
1314// import based class.
1415import MinCSS from "../Libraries/MinCSS.mjs" ;
1516
@@ -178,7 +179,11 @@ export default class WatchCSS {
178179
179180 watcher . on ( 'all' , async ( event , file , stats ) => {
180181 await this . #displayFileChanged( event , file , REPO_DIR ) ;
181- await this . #applyChanges( event , file ) ;
182+ try {
183+ await this . #applyChanges( event , file ) ;
184+ } catch ( err ) {
185+ console . error ( TextStyles . txtError ( 'Error! ' ) , err ) ;
186+ }
182187 console . log ( ' Finish task for file changed (' + event + ').' ) ;
183188 } ) ;
184189 } // run
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {deleteAsync} from 'del';
1010import path from 'node:path' ;
1111// import this app's useful class.
1212import FS from "../Libraries/FS.mjs" ;
13+ import TextStyles from "../Libraries//TextStyles.mjs" ;
1314// import sub class.
1415import JsBundler from './inc/jsBundler.mjs' ;
1516
@@ -128,7 +129,18 @@ export default class WatchJS {
128129
129130 watcher . on ( 'all' , async ( event , file , stats ) => {
130131 await this . #displayFileChanged( event , file , REPO_DIR ) ;
131- await this . #applyChanges( event , file ) ;
132+ try {
133+ await this . #applyChanges( event , file ) ;
134+ } catch ( err ) {
135+ let errorMessage = ' Error! ' + err . message ;
136+ if ( err . filename ) {
137+ errorMessage += "\n" + ' File: ' + err . filename ;
138+ }
139+ if ( err . line ) {
140+ errorMessage += "\n" + ' Line: ' + err . line ;
141+ }
142+ console . error ( TextStyles . txtError ( errorMessage ) ) ;
143+ }
132144 console . log ( ' Finish task for file changed (' + event + ').' ) ;
133145 } ) ;
134146 } // run
You can’t perform that action at this time.
0 commit comments