mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
Improve error page when throwing exception
This commit is contained in:
parent
f8735dc450
commit
0d7e0ca8a8
@ -134,9 +134,12 @@ export default context => {
|
|||||||
return _app
|
return _app
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
if (error && error instanceof Error) {
|
if (error && (error instanceof Error || error.constructor.toString().indexOf('Error()') !== -1)) {
|
||||||
error = { statusCode: 500, message: error.message }
|
error = { statusCode: 500, message: error.message }
|
||||||
}
|
}
|
||||||
|
else if (typeof error === 'string') {
|
||||||
|
error = { statusCode: 500, message: error }
|
||||||
|
}
|
||||||
context.nuxt.error = context.error(error)
|
context.nuxt.error = context.error(error)
|
||||||
<%= (store ? 'context.nuxt.state = store.state' : '') %>
|
<%= (store ? 'context.nuxt.state = store.state' : '') %>
|
||||||
return _app
|
return _app
|
||||||
|
Loading…
Reference in New Issue
Block a user