mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Notifier] added better error descriptions
(cherry picked from commit 9efd34bc69
)
This commit is contained in:
parent
79f10d28a6
commit
a723e61940
2 changed files with 11 additions and 2 deletions
|
@ -14,7 +14,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
if (!myHandlers.length) {
|
||||
notify.fatal(new Error('unhandled error ' + (error.stack || error.message)));
|
||||
notify.fatal(new Error(`unhandled courier request error: ${ notify.describeError(error) }`));
|
||||
} else {
|
||||
myHandlers.forEach(function (handler) {
|
||||
handler.defer.resolve(error);
|
||||
|
|
|
@ -86,12 +86,19 @@ define(function (require) {
|
|||
if (typeof msg === 'string') {
|
||||
rtn += msg;
|
||||
} else if (msg instanceof Error) {
|
||||
rtn += msg.message;
|
||||
rtn += describeError(msg);
|
||||
}
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
function describeError(err) {
|
||||
if (!err) return undefined;
|
||||
if (err.body && err.body.message) return err.body.message;
|
||||
if (err.message) return err.message;
|
||||
return '' + err;
|
||||
}
|
||||
|
||||
function formatInfo() {
|
||||
var info = [];
|
||||
|
||||
|
@ -281,6 +288,8 @@ define(function (require) {
|
|||
}, cb);
|
||||
};
|
||||
|
||||
Notifier.prototype.describeError = describeError;
|
||||
|
||||
if (log === _.noop) {
|
||||
Notifier.prototype.log = _.noop;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue