Merge pull request #2465 from thevoltagesource/getFileMtimeMs_Unhandled_Exception

Add try/catch to fileUtils.getFileMtimeMs
This commit is contained in:
advplyr 2023-12-31 15:34:43 -06:00 committed by GitHub
commit 5336864f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,12 @@ module.exports.getFileSize = async (path) => {
* @returns {Promise<number>} epoch timestamp
*/
module.exports.getFileMTimeMs = async (path) => {
return (await getFileStat(path))?.mtimeMs || 0
try {
return (await getFileStat(path))?.mtimeMs || 0
} catch (err) {
Logger.error(`[fileUtils] Failed to getFileMtimeMs`, err)
return 0
}
}
/**