Skip to content

Commit

Permalink
fix: handle errors from the sdk, (#585)
Browse files Browse the repository at this point in the history
add default error 400
  • Loading branch information
thewahome authored Jun 23, 2020
1 parent 413465e commit e3ce020
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/services/actions/query-action-creators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ export function runQuery(query: IQuery): Function {
if (tokenPresent) {
return authenticatedRequest(dispatch, query).then(async (response: Response) => {
await processResponse(response, respHeaders, dispatch, createdAt);
}).catch(async (error: any) => {
dispatch(queryResponse({
body: error,
headers: null
}));
return dispatch(setQueryResponseStatus({
messageType: MessageBarType.error,
ok: false,
status: 400,
statusText: 'Bad Request'
}));
});
}

Expand Down

0 comments on commit e3ce020

Please sign in to comment.