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

ui: fix errors doesn't display #794

Merged
merged 6 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion ui/dashboardApp/layout/signin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function useSignInSubmit(
singleSpa.navigateToUrl(successRoute)
} catch (e) {
if (!e.handled) {
setError(t('signin.message.error', { msg: e.message }))
setError(t('signin.message.error', { msg: e.msg }))
baurine marked this conversation as resolved.
Show resolved Hide resolved
onFailure()
}
} finally {
Expand Down
4 changes: 3 additions & 1 deletion ui/lib/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ function initAxios() {
}
}
const content = i18next.t(errCode)
err.message = content
// err.message = content // sometimes we can't change err.message at all, still don't know the exact reason
baurine marked this conversation as resolved.
Show resolved Hide resolved
err.msg = content
// console.log('err', { ...err }) // you can't see message but msg field in the log

if (errCode === 'error.api.unauthorized') {
// Handle unauthorized error in a unified way
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/components/ErrorBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function ErrorBar({ errors }: IErrorBarProps) {
// show at most 3 kinds of errors
const errorMsgs = useMemo(
() =>
_.uniq(_.map(errors, (err) => err?.message || ''))
_.uniq(_.map(errors, (err) => err?.msg || err?.message || ''))
.filter((msg) => msg !== '')
.slice(0, 3),
[errors]
Expand Down