Skip to content

Commit

Permalink
ui: fix errors doesn't show bug
Browse files Browse the repository at this point in the history
  • Loading branch information
baurine committed Nov 11, 2020
1 parent ab97091 commit a346e0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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
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

0 comments on commit a346e0d

Please sign in to comment.