-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backend: show 403 Forbidden rather than 500 if access was not allowed:
- I created a custom error class, AccessError, in order to distinguish access errors from the rest in our handleStandardResponse(). - The Service will now send an AccessError if the reason is that the authenticated user lacks autorizaton to a certain resource.
- Loading branch information
Showing
3 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @summary Basic Error class with unique 'name' property to make it easy | ||
* to distinguish AccessError. | ||
* | ||
* @export | ||
* @class AccessError | ||
* @extends {Error} | ||
*/ | ||
|
||
export class AccessError extends Error { | ||
constructor(message, options) { | ||
super(message, options); | ||
} | ||
|
||
get name() { | ||
return "AccessError"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters