Skip to content

Something similar to a 500 response but on the client. #179

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

Closed
mtscout6 opened this issue Aug 7, 2014 · 6 comments
Closed

Something similar to a 500 response but on the client. #179

mtscout6 opened this issue Aug 7, 2014 · 6 comments

Comments

@mtscout6
Copy link
Contributor

mtscout6 commented Aug 7, 2014

So, I did something stupid (meh, it's bound to happen). Which caused the following in my console:

error

Granted, I know this means that I need to add better error handling, and I will. However, when something like this happens in production then the screen is just blank, which is not ideal for an end user.

It'd be nice if there was an error handler that got called that could deal with it so the page is not just blank. Similar to how some web servers serve up a custom page for a 500 response.

Something like <UnhandledErrorRoute handler={CustomerErrorHandler} /> no path needed since it would stand at whatever url had the error.

@ryanflorence
Copy link
Member

#152 ought to do the trick :)

... when its merged.

@ryanflorence
Copy link
Member

Then you could:

function fivehundred() {
  Router.replaceWith('500');
}

var routes = (
  <Routes onTransitionError={fivehundred}>
    <Route name="500" path="error" handler={FiveHundred}/>
  </Routes>
);

If this becomes a common pattern, maybe we provide an <ErrorRoute/>.

@mtscout6
Copy link
Contributor Author

mtscout6 commented Aug 7, 2014

Awesome, I look forward to using it thanks!

@azaharakis
Copy link

Hi guys, looking at:
https://github.com/rackt/react-router/blob/4ec1f289962217dbd84a8f60d306cfd4d45bf561/UPGRADE_GUIDE.md#routes-ontransitionerror-onabortedtransition
the above technique is removed? Do you recommend another approach? Thanks heaps

@kellyrmilligan
Copy link
Contributor

+1 on this, if i'm doing some async work between screens, and there is an error, i'd like to render something but keep the url that was pushed into history as is. similar to displaying an error page from the server.

@rattrayalex
Copy link

Since this has been un-fixed, can the issue be re-opened?

@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants