Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add console logging che-server exception messages #913

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/dashboard-frontend/src/store/SanityCheck/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import { Action, Reducer } from 'redux';
import { AppThunk } from '..';
import { helpers } from '@eclipse-che/common';
import { container } from '../../inversify.config';
import { getDefer } from '../../services/helpers/deferred';
import { delay } from '../../services/helpers/delay';
Expand Down Expand Up @@ -118,6 +119,14 @@ export const actionCreators: ActionCreators = {
type: Type.RECEIVED_BACKEND_CHECK_ERROR,
error: errorMessage,
});
console.error(helpers.errors.getMessage(e));
if (
helpers.errors.includesAxiosResponse(e) &&
e.response.data.trace &&
Array.isArray(e.response.data.trace)
) {
console.error(e.response.data.trace.join('\n'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.error(e.response.data.trace.join('\n'));
console.error(common.helpers.errors.getMessage(e));

@vinokurig Could you move the next code e.response.data.trace.join('\n') into 'getMessage' function (https://github.com/eclipse-che/che-dashboard/blob/main/packages/common/src/helpers/errors.ts#L63-L65) ?

Copy link
Contributor Author

@vinokurig vinokurig Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a stack trace list and it is provision error specific, so it makes no sense to put it into the common error class.

}
throw new Error(errorMessage);
}
},
Expand Down
Loading