refactor: ♻️ improve readDriectory function
I improved use of errorMessage
This commit is contained in:
parent
83c0af64c9
commit
61af819a54
1 changed files with 3 additions and 6 deletions
|
@ -14,11 +14,8 @@ export default async (filePath: string) => {
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error({
|
const errorMessage = `Error checking directory ${filePath}: ${error}`;
|
||||||
message: `Error checking directory ${filePath}`,
|
logger.error({ message: errorMessage, error, directoryPath });
|
||||||
error,
|
throw new Error(errorMessage);
|
||||||
directoryPath,
|
|
||||||
});
|
|
||||||
throw new Error(`Error checking directory ${filePath}: ${error}`);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue