1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Catch errors thrown in _app.js (#4607)

This commit is contained in:
Tim Neutkens 2018-06-14 15:58:31 +02:00 committed by GitHub
parent 6d47d03611
commit e881c1b386
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}