[errors] tweak error messages to be more human readable
From: [index_not_found_exception] no such index, with: {"resource.type":"index_or_alias","resource.id":"logstash-2015.09.01","index":"logstash-2015.09.01"}
To: [index_not_found_exception] no such index, with { resource.type=index_or_alias resource.id=logstash-2015.09.01 index=logstash-2015.09.01 }
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
var _ = require('./utils');
|
||||
var qs = require('querystring');
|
||||
var errors = module.exports;
|
||||
|
||||
var canCapture = (typeof Error.captureStackTrace === 'function');
|
||||
@ -164,7 +165,11 @@ _.each(statusCodes, function (name, status) {
|
||||
|
||||
var extraData = _.omit(cause, ['type', 'reason']);
|
||||
if (_.size(extraData)) {
|
||||
memo += ', with: ' + JSON.stringify(extraData);
|
||||
memo += ', with { ' + qs.stringify(extraData, ' ', '=', {
|
||||
encodeURIComponent: function (v) {
|
||||
return String(v).split('\n').join('\\n');
|
||||
}
|
||||
}) + ' }';
|
||||
}
|
||||
|
||||
return memo;
|
||||
@ -182,4 +187,4 @@ _.each(statusCodes, function (name, status) {
|
||||
_.inherits(StatusCodeError, ErrorAbstract);
|
||||
errors[className] = StatusCodeError;
|
||||
errors[status] = StatusCodeError;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user