don't throw error
This commit is contained in:
parent
3287ae587e
commit
4c695f83c6
|
@ -188,16 +188,17 @@ export async function isFolder(dirPath: string) {
|
|||
const stats = await fs.stat(dirPath);
|
||||
return stats.isDirectory();
|
||||
} catch (e) {
|
||||
let err = e;
|
||||
// if code is defined, it's an error from fs.stat
|
||||
if (typeof e.code !== 'undefined') {
|
||||
// ENOENT means the file does not exist
|
||||
if (e.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
throw Error(`fs error code: ${e.code}`);
|
||||
} else {
|
||||
throw e;
|
||||
err = Error(`fs error code: ${e.code}`);
|
||||
}
|
||||
logError(err, 'isFolder failed');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue