diff --git a/lib/app/components/nuxt-error.vue b/lib/app/components/nuxt-error.vue index fe022885bf..d285c0b44e 100644 --- a/lib/app/components/nuxt-error.vue +++ b/lib/app/components/nuxt-error.vue @@ -31,7 +31,7 @@ export default { props: ['error'], head () { return { - title: this.error ? ((this.error.statusCode || 500) + ' - ' + (this.error.message || 'Error')) : '500 - Error', + title: this.error ? ((this.error.statusCode || 500) + ' - ' + (this.error.message || 'Nuxt Server Error')) : '500 - Nuxt Server Error', link: [ { rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css', type: 'text/css', media: 'all' }, { rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css', type: 'text/css', media: 'all' } @@ -64,6 +64,7 @@ export default { .__nuxt-error-page .error-box { box-shadow: 0px 0px 9px #d3d3d3; padding: 10px; + text-align: left; } .__nuxt-error-page .poweredby { text-align: center; diff --git a/lib/app/views/error.html b/lib/app/views/error.html index 21e1c2d18d..3016b24409 100644 --- a/lib/app/views/error.html +++ b/lib/app/views/error.html @@ -1,7 +1,7 @@ - {{ status }} - {{ name }} + {{ status }} - {{ message }} @@ -36,10 +36,6 @@ margin: 0 auto; max-width: 70%; } -.__nuxt-error-page .error-box { - box-shadow: 0px 0px 9px #d3d3d3; - padding: 10px; -} .__nuxt-error-page .poweredby { text-align: center; margin-top: 10%; @@ -58,9 +54,8 @@ pre {
-

{{ status }}

-

{{ name }}

- <%if(debug){%>
{{ message }}
<%}%> +

{{ status }}

+

{{ message }}

diff --git a/lib/core/renderer.js b/lib/core/renderer.js index 9cc2d24fe8..9b40662f6a 100644 --- a/lib/core/renderer.js +++ b/lib/core/renderer.js @@ -281,12 +281,12 @@ export default class Renderer extends Tapable { // ensure statusCode, message and name fields err.statusCode = err.statusCode || 500 err.message = err.message || 'Nuxt Server Error' - err.name = (!err.name || err.name === 'Error') ? 'Nuxt Server Error' : err.name + err.name = (!err.name || err.name === 'Error') ? 'NuxtServerError' : err.name const sendResponse = (content, type = 'text/html') => { // Set Headers res.statusCode = err.statusCode - res.statusMessage = err.name + res.statusMessage = this.options.render.debug ? err.message : err.name res.setHeader('Content-Type', type + '; charset=utf-8') res.setHeader('Content-Length', Buffer.byteLength(content)) diff --git a/test/error.test.js b/test/error.test.js index b65a6b3a59..17f13eeda0 100644 --- a/test/error.test.js +++ b/test/error.test.js @@ -35,7 +35,7 @@ test('/404 should display an error too', async t => { test('/ with renderAndGetWindow()', async t => { const err = await t.throws(nuxt.renderAndGetWindow(url('/'))) t.is(err.response.statusCode, 500) - t.is(err.response.statusMessage, 'Nuxt Server Error') + t.is(err.response.statusMessage, 'NuxtServerError') }) // Close server and ask nuxt to stop listening to file changes