Open loay opened 8 years ago
+1
what about something like
"final:after": {
"strong-error-handler": {
"params": {
"debug": true,
"log": false,
"htmlRenderer": "$!../path/to/html-renderer",
"jsonRenderer": "$!../path/to/json-renderer",
"xmlRenderer": "$!../path/to/xml-renderer",
"jsonSerializer": "$!../path/to/json-serializer"
}
}
}
See my attempt to roll this in: https://github.com/charlie-s/strong-error-handler/commit/c2335b34d213eaa2d8f3f658e957401ec4dcc036
Note that the order of arguments in negotiateContentProducer seemed to be incorrect (https://github.com/strongloop/strong-error-handler/issues/46) so that fix was included in this commit.
Using the above configuration and a function like
module.exports = function sendText(res, data) {
let content = `${data.name}: ${data.message} (${data.details}) [${data.code}]`;
res.setHeader('Content-Type', 'plain/text; charset=utf-8');
res.end(content, 'utf-8');
};
would this help address #6 as well?
is this ever going to be implemented?
Customize html templates in strong-error-handler, see https://github.com/strongloop/loopback/issues/1650#issuecomment-161920555 for details.
Configuration options:
Requires #5