diff --git a/lib/core/renderer.js b/lib/core/renderer.js index 2590e754e7..053e22c9e0 100644 --- a/lib/core/renderer.js +++ b/lib/core/renderer.js @@ -280,7 +280,7 @@ 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 || 'Nuxt Server Error' + err.name = (!err.name || err.name === 'Error') ? 'Nuxt Server Error' : err.name const sendResponse = (content, type = 'text/html') => { // Set Headers diff --git a/test/error.test.js b/test/error.test.js index 9a7952ccc6..b65a6b3a59 100644 --- a/test/error.test.js +++ b/test/error.test.js @@ -34,8 +34,8 @@ test('/404 should display an error too', async t => { test('/ with renderAndGetWindow()', async t => { const err = await t.throws(nuxt.renderAndGetWindow(url('/'))) - t.true(String(err).includes('Error: socket hang up')) - // t.is(err.response.statusCode, 500) + t.is(err.response.statusCode, 500) + t.is(err.response.statusMessage, 'Nuxt Server Error') }) // Close server and ask nuxt to stop listening to file changes