From 509a22a5b4dd0fc3acedbcb588023a6e8c0f479f Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 24 Apr 2024 20:47:32 -0400 Subject: [PATCH] chore: Add more descriptive error for missing file system permission --- plugins/storage/server/api/files.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/storage/server/api/files.ts b/plugins/storage/server/api/files.ts index 0d66e8d5c..6b5c90736 100644 --- a/plugins/storage/server/api/files.ts +++ b/plugins/storage/server/api/files.ts @@ -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,