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);
|
const stats = await fs.stat(dirPath);
|
||||||
return stats.isDirectory();
|
return stats.isDirectory();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
let err = e;
|
||||||
// if code is defined, it's an error from fs.stat
|
// if code is defined, it's an error from fs.stat
|
||||||
if (typeof e.code !== 'undefined') {
|
if (typeof e.code !== 'undefined') {
|
||||||
// ENOENT means the file does not exist
|
// ENOENT means the file does not exist
|
||||||
if (e.code === 'ENOENT') {
|
if (e.code === 'ENOENT') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
throw Error(`fs error code: ${e.code}`);
|
err = Error(`fs error code: ${e.code}`);
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
logError(err, 'isFolder failed');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue