mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
use Object#setPrototypeOf, #49386
This commit is contained in:
@@ -1890,6 +1890,12 @@ export class FileSystemError extends Error {
|
||||
super(URI.isUri(uriOrMessage) ? uriOrMessage.toString(true) : uriOrMessage);
|
||||
this.name = code ? `${code} (FileSystemError)` : `FileSystemError`;
|
||||
|
||||
// workaround when extending builtin objects and when compiling to ES5, see:
|
||||
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
||||
if (typeof (<any>Object).setPrototypeOf === 'function') {
|
||||
(<any>Object).setPrototypeOf(this, FileSystemError.prototype);
|
||||
}
|
||||
|
||||
if (typeof Error.captureStackTrace === 'function' && typeof terminator === 'function') {
|
||||
// nice stack traces
|
||||
Error.captureStackTrace(this, terminator);
|
||||
|
||||
Reference in New Issue
Block a user