Add try/catch to fileutils.getFileMtimeMs

This commit is contained in:
Jacob Southard 2023-12-29 10:04:59 -06:00
parent fbbceddba8
commit e4effebc19

View File

@ -81,7 +81,12 @@ module.exports.getFileSize = async (path) => {
* @returns {Promise<number>} epoch timestamp * @returns {Promise<number>} epoch timestamp
*/ */
module.exports.getFileMTimeMs = async (path) => { 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
}
} }
/** /**