Unverified Commit e881c1b3 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Catch errors thrown in _app.js (#4607)

parent 6d47d036
...@@ -260,7 +260,12 @@ export default class Router { ...@@ -260,7 +260,12 @@ export default class Router {
const Component = this.ErrorComponent const Component = this.ErrorComponent
routeInfo = { Component, err } routeInfo = { Component, err }
const ctx = { err, pathname, query } 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 routeInfo.error = err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment