DEV Community

Discussion on: Add Sentry to Vercel Next.js API Routes

Collapse
 
scefali profile image
Stephen Cefali

@aryanjnyc Thanks for writing this blog. My question to you is why are you returning the error instead of throwing it to the caller function?

Collapse
 
aryanjnyc profile image
Aryan J

Oh my. Good catch. There's no reason for it and, in fact, that's definitely wrong. That should be a throw.

Collapse
 
scefali profile image
Stephen Cefali

@aryanjnyc Thanks for making the update! I do apologize that the documentation we had was incorrect.

Collapse
 
aryanjnyc profile image
Aryan J • Edited

Ah, I actually found the root of my error. This serverErrorHandler is heavily inspired by existing Sentry docs that were recently changed. Here is the change this all stemmed from: github.com/getsentry/sentry-docs/c...

Either way, yeah, good find! Thanks a bunch. I also updated my pull request to the Sentry docs: github.com/getsentry/sentry-docs/p...