diff --git a/lib/watcher.js b/lib/watcher.js index fb610d0..7c0c53d 100644 --- a/lib/watcher.js +++ b/lib/watcher.js @@ -151,6 +151,13 @@ class Watcher // Retrieve stats fs.stat(_path, (error, stats) => { + // Error + if(error) + { + console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('add')} - ${chalk.cyan(_path)} - ${chalk.red('error')}`) + return + } + // Max file size if(this.config.maxFileSize < stats.size) { @@ -160,6 +167,13 @@ class Watcher // Read fs.readFile(_path, (error, data) => { + // Error + if(error) + { + console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('add')} - ${chalk.cyan(_path)} - ${chalk.red('error')}`) + return + } + if(file.canRead) { file.content = data.toString() @@ -197,6 +211,13 @@ class Watcher // Retrieve stats fs.stat(_path, (error, stats) => { + // Error + if(error) + { + console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('change')} - ${chalk.cyan(_path)} - ${chalk.red('error')}`) + return + } + // Test max file size if(this.config.maxFileSize < stats.size) { @@ -206,6 +227,13 @@ class Watcher // Read fs.readFile(_path, (error, data) => { + // Error + if(error) + { + console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('change')} - ${chalk.cyan(_path)} - ${chalk.red('error')}`) + return + } + if(file.canRead) { file.content = data.toString()