mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Render error as errorHtml (#3142)
This commit is contained in:
parent
4d2ea0ce80
commit
8e55adf4ec
|
@ -78,17 +78,20 @@ async function doRender (req, res, pathname, query, {
|
||||||
let html
|
let html
|
||||||
let head
|
let head
|
||||||
let errorHtml = ''
|
let errorHtml = ''
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (err && dev) {
|
||||||
|
errorHtml = render(createElement(ErrorDebug, { error: err }))
|
||||||
|
} else if (err) {
|
||||||
|
errorHtml = render(app)
|
||||||
|
} else {
|
||||||
html = render(app)
|
html = render(app)
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
head = Head.rewind() || defaultHead()
|
head = Head.rewind() || defaultHead()
|
||||||
}
|
}
|
||||||
const chunks = loadChunks({ dev, dir, dist, availableChunks })
|
const chunks = loadChunks({ dev, dir, dist, availableChunks })
|
||||||
|
|
||||||
if (err && dev) {
|
|
||||||
errorHtml = render(createElement(ErrorDebug, { error: err }))
|
|
||||||
}
|
|
||||||
|
|
||||||
return { html, head, errorHtml, chunks }
|
return { html, head, errorHtml, chunks }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue