Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

fix: handle parsing & primary error properly #235

Merged
merged 1 commit into from
May 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/request-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
});
};

Expand Down