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:
parent
6d47d03611
commit
e881c1b386
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue