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

403 HTTP Status code not returning correct error message #24

Closed
lifeofpavs opened this issue Jul 29, 2024 · 0 comments
Closed

403 HTTP Status code not returning correct error message #24

lifeofpavs opened this issue Jul 29, 2024 · 0 comments

Comments

@lifeofpavs
Copy link
Contributor

lifeofpavs commented Jul 29, 2024

Current behaviour

Trying to send data to the Events API with an unauthorized token returns Failed to parse JSON as the error code as res.json() throws an error.

Desired behaviour

Using an unauthorized token to throw Unauthorized as the error message rather than Failed to parse JSON as it can be misleading

I feel like adding:

 if (res.status === 403) {
        throw new Error("Unauthorized");
      }

to the fetch function on client.ts would solve the issue

@chronark chronark closed this as completed Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants