Skip to content

Commit 7ad8356

Browse files
authored
Fixed bug where error detail might be empty (#478)
* Fixed bug where error detail might be empty * Added null check to the detail string to prevent errors when detail is not set * Second check to validate the body field
1 parent 0695231 commit 7ad8356

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

frontend/src/actions/common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function handleErrors(reason, originalFunc){
6464
return (dispatch) => {
6565
dispatch({
6666
type: NOT_AUTHORIZED,
67-
reason: reason.body.detail,
67+
reason: reason.body !== undefined && reason.body.detail !== undefined? reason.body.detail : "Forbidden",
6868
stack: reason.stack ? reason.stack : "",
6969
receivedAt: Date.now()
7070
});
@@ -73,7 +73,7 @@ export function handleErrors(reason, originalFunc){
7373
return (dispatch) => {
7474
dispatch({
7575
type: NOT_FOUND,
76-
reason: reason.body.detail,
76+
reason: reason.body !== undefined && reason.body.detail !== undefined? reason.body.detail : "Not Found",
7777
stack: reason.stack ? reason.stack : "",
7878
receivedAt: Date.now()
7979
});

0 commit comments

Comments
 (0)