chore: Add more descriptive error for missing file system permission

This commit is contained in:
Tom Moor
2024-04-24 20:47:32 -04:00
parent 9b12d486f5
commit 509a22a5b4

View File

@@ -47,7 +47,16 @@ router.post(
throw AuthorizationError("Invalid key");
}
await attachment.writeFile(file);
try {
await attachment.writeFile(file);
} catch (err) {
if (err.message.includes("permission denied")) {
throw Error(
`Permission denied writing to "${key}". Check the host machine file system permissions.`
);
}
throw err;
}
ctx.body = {
success: true,