{"action":"closed","issue":{"url":"https://api.github.com/repos/rackt/react-router/issues/2338","labels_url":"https://api.github.com/repos/rackt/react-router/issues/2338/labels{/name}","comments_url":"https://api.github.com/repos/rackt/react-router/issues/2338/comments","events_url":"https://api.github.com/repos/rackt/react-router/issues/2338/events","html_url":"https://github.com/rackt/react-router/issues/2338","id":112648403,"number":2338,"title":"How to handle/catch errors when rendering components in router","user":{"login":"syltaxue","id":5742761,"avatar_url":"https://avatars.githubusercontent.com/u/5742761?v=3","gravatar_id":"","url":"https://api.github.com/users/syltaxue","html_url":"https://github.com/syltaxue","followers_url":"https://api.github.com/users/syltaxue/followers","following_url":"https://api.github.com/users/syltaxue/following{/other_user}","gists_url":"https://api.github.com/users/syltaxue/gists{/gist_id}","starred_url":"https://api.github.com/users/syltaxue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syltaxue/subscriptions","organizations_url":"https://api.github.com/users/syltaxue/orgs","repos_url":"https://api.github.com/users/syltaxue/repos","events_url":"https://api.github.com/users/syltaxue/events{/privacy}","received_events_url":"https://api.github.com/users/syltaxue/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rackt/react-router/labels/needs-help","name":"needs-help","color":"0052cc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-21T18:14:39Z","updated_at":"2015-10-21T20:18:06Z","closed_at":"2015-10-21T20:18:06Z","body":"Hi Guys,\r\n\r\nWhen we have errors in a component of the router, the entire tree might get taken down.\r\nFor example, in the router below, we have many route paths, and each path is a react component. When rendering any component, if there is an error, the router then gets to a bad state, and any further actions(e.g. a user click a link to render another route component ) may fail.  \r\nWhat would be the work around to catch/handle the errors in component rendering? And is there a way to handle the errors in the components level? \r\n\r\nThe use case here is: \r\nIn a component, I am rendering a basic framework + some other children components. Then I get errors when rendering the children components.\r\nIn this scenario, I want to keep the basic framework + render some errors messages to user, so I might need to find a way to handle/catch the errors in the component. Any ideas or suggestions?\r\n\r\n\r\n\r\n\r\n```js\r\nrender((\r\n  <Router>\r\n    <Route path=\"/\" component={App}>\r\n      <Route path=\"about\" component={About}/>\r\n      <Route path=\"users\" component={Users}>\r\n        <Route path=\"/user/:userId\" component={User}/>\r\n      </Route>\r\n    </Route>\r\n  </Router>\r\n), document.body)\r\n```"}}