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

fix(nms): Display correct axios errors #13986

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

voisey
Copy link
Contributor

@voisey voisey commented Sep 22, 2022

Summary

Closes #13948.

  • Modifies logic in getErrorMessage to use else if instead of if when checking if the error is an instance of Error. Otherwise, when an axios error message is encountered, the errorMessage always gets overwritten to be the default.
  • Replaces the error field with message throughout nms/server so that it corresponds to the field that gets accessed when returning the axios error message.
  • Replaces custom isAxiosError function with axios.isAxiosError.

Test Plan

  • nms-workflow

On master, when trying to create two organizations with the same name on the host site, one gets "Request failed with status code 409". With these changes, one gets "Organization exists already".

Similarly, when trying to create two users with the same name, one gets "Request failed with status code 400" on master, but e.g. "Error: admin@magma.test already exists" with this PR.

Signed-off-by: Cameron Voisey <cameron.voisey@tngtech.com>
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines. label Sep 22, 2022
@github-actions
Copy link
Contributor

Thanks for opening a PR! 💯

A couple initial guidelines

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@github-actions github-actions bot added the component: nms NMS-related issue label Sep 22, 2022
@github-actions
Copy link
Contributor

dp-workflow

0 tests   0 ✔️  0s ⏱️
0 suites  0 💤
0 files    0

Results for commit c76c3cd.

@github-actions
Copy link
Contributor

nms-workflow

0 tests   0 ✔️  0s ⏱️
0 suites  0 💤
0 files    0

Results for commit c76c3cd.

@voisey voisey marked this pull request as ready for review September 22, 2022 10:07
@voisey voisey requested review from a team and sebathomas September 22, 2022 10:07
Copy link
Contributor

@sebathomas sebathomas left a comment

Choose a reason for hiding this comment

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

👍

@voisey voisey merged commit c825e1e into magma:master Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: nms NMS-related issue size/S Denotes a PR that changes 10-29 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show correct axios error messages to users
2 participants