Improve error page when throwing exception

This commit is contained in:
Sébastien Chopin 2017-01-19 16:39:36 +01:00
parent f8735dc450
commit 0d7e0ca8a8

View File

@ -134,9 +134,12 @@ export default context => {
return _app
})
.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 }
}
else if (typeof error === 'string') {
error = { statusCode: 500, message: error }
}
context.nuxt.error = context.error(error)
<%= (store ? 'context.nuxt.state = store.state' : '') %>
return _app