Skip to content

Wrong exception name (Object.captureException) when a 500 with Remix json response #5963

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

Closed
AbhiPrasad opened this issue Oct 14, 2022 Discussed in #5958 · 3 comments · Fixed by #6129
Closed

Wrong exception name (Object.captureException) when a 500 with Remix json response #5963

AbhiPrasad opened this issue Oct 14, 2022 Discussed in #5958 · 3 comments · Fixed by #6129
Assignees
Labels
hacktoberfest Meta: Help Wanted Package: remix Issues related to the Sentry Remix SDK

Comments

@AbhiPrasad
Copy link
Member

Discussed in #5958

Originally posted by jorisre October 14, 2022
When I throw a 500 json response with Remix, the exception name is incorrect.

throw json(
  { data: {} },
  {
    status: 500,
    statusText: "My error"
  }
);

Result in:

image

How I can set myself the exception name for Sentry ?

@AbhiPrasad
Copy link
Member Author

@jorisre question here, why are you throwing the json response? Shouldn't you just return an 500 error instead or throw an actual error? That might lead to better error messages showing up.

@jorisre
Copy link

jorisre commented Oct 14, 2022

You're right. But I prefer json response because I can pass down more data to the browser and display a better page (UX) to users.

What do you have in mind to improve this case? (maybe I can try to work on it)

@AbhiPrasad
Copy link
Member Author

Well we can try to then construct a better error here (what we pass into captureException):

captureException(isResponse(err) ? extractData(err) : err, scope => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Meta: Help Wanted Package: remix Issues related to the Sentry Remix SDK
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants