Skip to content

Use new error structure - #1502

Open
robbevp wants to merge 7 commits into
mainfrom
enhc/use-structured-errors
Open

Use new error structure#1502
robbevp wants to merge 7 commits into
mainfrom
enhc/use-structured-errors

Conversation

@robbevp

@robbevp robbevp commented Jul 25, 2026

Copy link
Copy Markdown
Member

Depends on accentor/api-client-js#821 and accentor/api#722

This updates web to work with the new structure or errors from the api and the way api-client-js wraps these in error classes.

  • Our errorStore now stores the error objects
  • The few cases where we added errors that do not originate in the API, now add a custom error type (PlayerError)
  • We render the errors based on the types
  • I converted all translations to the new structure (and fixed a few typos along the way). This was a bit of a mess, so I hope that I didn't miss something.
    We end up with quite a few less translations inside errors since we no longer have a key for each model.
  • I updated all locations where we manually called I18n.t with an error message

I did a bunch of test to check that I got the output I expected, but far from covered all possibilities and error cases.

@robbevp
robbevp requested a review from chvp as a code owner July 25, 2026 12:08
@robbevp robbevp self-assigned this Jul 25, 2026
@robbevp robbevp added the enhancement New feature or request label Jul 25, 2026
@robbevp
robbevp force-pushed the enhc/use-structured-errors branch from 969af16 to c2e58f5 Compare July 25, 2026 12:09
Comment thread src/components/Errors.vue
Comment on lines +9 to +10
<strong>{{ I18n.t(`errors.types.${error.name}`, error.name) }}:</strong
>&nbsp;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<strong>{{ I18n.t(`errors.types.${error.name}`, error.name) }}:</strong
>&nbsp;
<strong>{{ I18n.t(`errors.types.${error.name}`, error.name) }}:</strong>
&nbsp;

I'm allergic to these unnecessary no-whitespace-preserving prettier fixes 😅

Comment thread src/locales/en.json
},
"models": {
"auth_token": {
"base": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Indentation seems wrong here? Not necessarily for this PR, but can we check formatting in CI?

const confirmationMatch = (v: string): true | string =>
(!!v && v) === newUser.value.password ||
I18n.t("errors.user.password-confirmation");
I18n.t("errors.user.password_confirmation");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one seems wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants