mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[kfetch/FetchError] only call Error.captureStackTrace if it exists (#21376)
* [kfetch/FetchError] only call Error.captureStackTrace if it exists * add comment for clarity [skip ci]
This commit is contained in:
parent
7063dbcbd9
commit
f0140850db
1 changed files with 6 additions and 1 deletions
|
@ -28,7 +28,12 @@ import { metadata } from '../metadata';
|
|||
class FetchError extends Error {
|
||||
constructor(public readonly res: Response, public readonly body?: any) {
|
||||
super(res.statusText);
|
||||
Error.captureStackTrace(this, FetchError);
|
||||
|
||||
// captureStackTrace is only available in the V8 engine, so any browser using
|
||||
// a different JS engine won't have access to this method.
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, FetchError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue