[Feature Request]: RSC error - allow error.code or an other specialized prop to be forwarded to the client #27362
Labels
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
I've observed that React Server Components currently send a digest to the client in case of an error, without forwarding the exact error. This behavior can sometimes be limiting, especially when we want to handle specific error cases on the client-side, like the 401 Unauthorized status.
To tackle this, I've introduced a mechanism that selectively forwards specific error codes to the client, without compromising on security or exposing sensitive error messages.
Possible solutions:
error.code
property during error scenarios.error.code
is present and matches our predefined whitelist, it's forwarded to the client. This allows the client to understand specific error types without exposing detailed server messages.clientHint
. This prop can be set on the server-side and is designed to provide hints or specific behaviors that the client should adopt upon encountering the error.clientHint
prop and act accordingly, giving developers a structured way to pass actionable instructions from server to client during error scenarios.Benefits of this Change:
Looking Forward:
Looking forward to the community's thoughts!
Thank you!
The text was updated successfully, but these errors were encountered: