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(remix): Change handleError in server entry #621

Merged
merged 4 commits into from
Jul 10, 2024

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Jul 8, 2024

Changes the produced code for handleError based on the docs.

docs PR: getsentry/sentry-docs#10597
closes: getsentry/sentry-javascript#12785

@s1gr1d s1gr1d requested a review from onurtemizkan July 8, 2024 08:52
export const HANDLE_ERROR_TEMPLATE_V2 = `function handleError(error, { request }) {
Sentry.captureRemixServerException(error, 'remix.server', request, true);
}
export const HANDLE_ERROR_TEMPLATE_V2 = `export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This generated the code below in my test app:

export export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {
  // Custom handleError implementation
});

We should remove the logic that:

  • exports the code in the template - handle-error.ts
  • Or we can remove export from the template instead.

@onurtemizkan
Copy link
Collaborator

@s1gr1d - I updated the codemod to work on the new template.

@s1gr1d s1gr1d requested a review from onurtemizkan July 9, 2024 19:19
@s1gr1d
Copy link
Member Author

s1gr1d commented Jul 9, 2024

Looks good! Feel free to merge it after you accept it. I cannot accept as I opened the PR.

@onurtemizkan onurtemizkan merged commit 177f6e7 into master Jul 10, 2024
12 checks passed
@onurtemizkan onurtemizkan deleted the sig/update-handle-error branch July 10, 2024 10:31
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

Successfully merging this pull request may close these issues.

wrapHandleErrorWithSentry documentation is incorrect
2 participants