- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 143
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
experimental: error callback for middleware #1280
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There is documentation for
We should add Each of these usage sections discuss how onError can be used:
Logging crashes on the server is the primary use case that I have for onError. I have server-side console.error hooked up to my error tracking - so really I won't have to add anything else if we add that. But... for people that want to do their own instrumentation and maybe ignore certain errors, it would be really great to register a callback to do that. In those React usage docs, the methods for setting status code or making the onError error accessible to the request handler are interesting... but as soon as there is a suspense boundary, they won't work as expected because the onError will happen after the response starts streaming. If I want to add error reporting for everything collected by |
Sorry... I realize I was confusing react-dom/server renderToReadableStream with react-server-dom-webpack renderToReadableStream. I wonder if they are intended to work in a similar way? |
Yeah, I've read the react-dom docs once before.
Nice catch.
Yes, my expectation is write your own middleware. I haven't tried anything and not sure if it works as you expect. Feedback is welcome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think it is ready to merge unless you aren't sure that you like how the callbacks are being passed through.
Thanks for the review. I'm not 100% confident, but as it's marked as |
(I'm still not sure how
onError
works. Isn't it documented?)