handleError = err => {
        this.emit('error', request, err);
        const { message, stack } = err;
        span.setTag(Tags.ERROR, true);
        span.log({ message, stack });
        if (shouldWriteHead) {
            shouldWriteHead = false;
            let statusCode = 500;
            if (err.code === TEMPLATE_NOT_FOUND) {
                statusCode = 404;
            }
            span.setTag(Tags.HTTP_STATUS_CODE, statusCode);

            response.writeHead(statusCode, responseHeaders);
            // To render with custom error template
            if (typeof err.presentable === 'string') {
                response.end(`${err.presentable}`);
            } else {
                response.end(INTERNAL_SERVER_ERROR);
            }
            span.finish();
        } else {
            contentLengthStream.end();
        }
    }
Process the HTTP Request to the Tailor Middleware

@param {Object} options - Options object passed to Tailor
@param {Object} request - HTTP request stream of Middleware
@param {Object} response - HTTP response stream of middleware