Skip to content

Commit

Permalink
feat: send back 403 on no-privileges error
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Oct 16, 2020
1 parent 222b4c9 commit 14f9d8b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/controllers/helpers.js
Expand Up @@ -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') {
Expand Down

0 comments on commit 14f9d8b

Please sign in to comment.