forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Better error notifications in jobs list (elastic#20880)
* [ML] Better error notifications in jobs list * removing test data
- Loading branch information
1 parent
fd97bd3
commit a531227
Showing
3 changed files
with
67 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { KbnError } from 'ui/errors'; | ||
|
||
export class MLRequestFailure extends KbnError { | ||
// takes an Error object and and optional response object | ||
// if error is falsy (null) the response object will be used | ||
// notify will show the full expandable stack trace of the response if a response object is used and no error is passed in. | ||
constructor(error, resp) { | ||
error = error || {}; | ||
super(error.message || JSON.stringify(resp), MLRequestFailure); | ||
|
||
this.origError = error; | ||
this.resp = (typeof resp === 'string') ? JSON.parse(resp) : resp; | ||
} | ||
} |