diff --git a/lib/request-handler.js b/lib/request-handler.js index 9199ff9..7cc74dd 100644 --- a/lib/request-handler.js +++ b/lib/request-handler.js @@ -23,6 +23,8 @@ const FRAGMENT_EVENTS = [ 'fallback', 'warn' ]; +// Occurs when Template parsing fails/Primary Fragment Errors out +const INTERNAL_SERVER_ERROR = 'Internal Server Error'; /** * Process the HTTP Request to the Tailor Middleware @@ -97,7 +99,7 @@ module.exports = function processRequest(options, request, response) { if (typeof err.presentable === 'string') { response.end(`${err.presentable}`); } else { - response.end(); + response.end(INTERNAL_SERVER_ERROR); } span.finish(); } else { @@ -153,7 +155,7 @@ module.exports = function processRequest(options, request, response) { this.emit('error', request, err); span.setTag(Tags.HTTP_STATUS_CODE, 500); response.writeHead(500, responseHeaders); - response.end(); + response.end(INTERNAL_SERVER_ERROR); }); };