Rethrow functions errors to persist Vercel logs
Closed this issue · 2 comments
Vercel only store logs of functions that threw an error, this means that even if a next-rpc function throws, its logs won't be persisted in the vercel logs panel because next-rpc catches the error here
it could instead rethrow the error to make vercel persist the logs
Rethrowing the error will set the status to 500 automatically, which from #19 i understand it's something you don't want, so maybe this behaviour could be set with an option rethrowOnError
or similar?
I can open a PR if you agree
I'm still reluctant to add such option for now. The error will be passed to the browser where it will be rethrown, so you'll have to set up logging there, with Sentry for instance.
Also, it's possible to persist logs with Vercel, even if the function doesn't fail.
I sill think it would be valuable for many users to have this option, having the ability to quickly check a deployemnt function errors on the vercel dashboard is invaluable to me
I can open a PR if you give me the green light