Skip to content

Commit

Permalink
fixup! Add logging che-server exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vinokurig committed Sep 6, 2023
1 parent b216333 commit 1ed02e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/dashboard-frontend/src/store/SanityCheck/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const actionCreators: ActionCreators = {
delay(1000);
}
}
} catch (e: any) {
} catch (e) {
let errorMessage =
'Backend is not available. Try to refresh the page or re-login to the Dashboard.';
if (isUnauthorized(e) || isForbidden(e)) {
Expand All @@ -120,7 +120,11 @@ export const actionCreators: ActionCreators = {
error: errorMessage,
});
console.error(helpers.errors.getMessage(e));
if (e.response && e.response.data && e.response.data.trace) {
if (
helpers.errors.includesAxiosResponse(e) &&
e.response.data.trace &&
Array.isArray(e.response.data.trace)
) {
console.error(e.response.data.trace.join('\n'));
}
throw new Error(errorMessage);
Expand Down

0 comments on commit 1ed02e8

Please sign in to comment.