Fix FileUtils promises
This commit is contained in:
parent
65cf800283
commit
d11cfbcdaa
|
@ -102,7 +102,7 @@ class FileUtils {
|
|||
}
|
||||
|
||||
static async directoryExists(path) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.stat(path, (err, stats) => {
|
||||
if (err) return reject({
|
||||
'message': `Directory does not exist: ${path}`,
|
||||
|
@ -126,7 +126,7 @@ class FileUtils {
|
|||
throw (err);
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(path, 'utf-8', (err, data) => {
|
||||
if (err) reject({
|
||||
'message': `Could not read file: ${path}`,
|
||||
|
@ -221,4 +221,4 @@ class Filters {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = { Logger, Utils, FileUtils, Filters }
|
||||
module.exports = { Logger, Utils, FileUtils, Filters };
|
||||
|
|
Loading…
Reference in New Issue