diff --git a/src/controllers/helpers.js b/src/controllers/helpers.js index 76dc5f6fa4..4f1a8c6d81 100644 --- a/src/controllers/helpers.js +++ b/src/controllers/helpers.js @@ -357,6 +357,13 @@ helpers.formatApiResponse = async (statusCode, res, payload) => { message = payload.message; } + // Update status code based on some common error codes + switch (payload.message) { + case '[[error:no-privileges]]': + statusCode = 403; + break; + } + const returnPayload = helpers.generateError(statusCode, message); if (global.env === 'development') {