Skip to content

Commit

Permalink
Catch errors thrown in _app.js (#4607)
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens authored Jun 14, 2018
1 parent 6d47d03 commit e881c1b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,12 @@ export default class Router {
const Component = this.ErrorComponent
routeInfo = { Component, err }
const ctx = { err, pathname, query }
routeInfo.props = await this.getInitialProps(Component, ctx)
try {
routeInfo.props = await this.getInitialProps(Component, ctx)
} catch (err) {
console.error('Error in error page `getInitialProps`: ', err)
routeInfo.props = {}
}

routeInfo.error = err
}
Expand Down

0 comments on commit e881c1b

Please sign in to comment.