Add error handling in globals to help troubleshoot production

parent 042b4875
......@@ -70,7 +70,13 @@ function globals (app) {
// Ensure that the data directory path exists as other parts of the application
// will rely on it being there.
fs.ensureDirSync(dataDirectoryPath)
try {
fs.ensureDirSync(dataDirectoryPath)
} catch (error) {
const message = `Could not ensure directory for ${dataDirectoryPath}: ${error}`
console.log(message)
throw new Error(message)
}
app.set('dataDirectoryPath', dataDirectoryPath)
app.set('serverSecretFilePath', serverSecretFilePath)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment