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

Make sure page-loader doesn't throw errors when registering. (#2282)

Even if it does it, we need to mark it as a page error.
This commit is contained in:
Arunoda Susiripala 2017-06-16 16:43:55 +05:30 committed by GitHub
parent db1ee2e161
commit 3898cb53b4

View file

@ -87,9 +87,14 @@ export default class PageLoader {
// This method if called by the route code.
registerPage (route, regFn) {
const register = () => {
const { error, page } = regFn()
this.pageCache[route] = { error, page }
this.pageRegisterEvents.emit(route, { error, page })
try {
const { error, page } = regFn()
this.pageCache[route] = { error, page }
this.pageRegisterEvents.emit(route, { error, page })
} catch (error) {
this.pageCache[route] = { error }
this.pageRegisterEvents.emit(route, { error })
}
}
// Wait for webpack to became idle if it's not.