Skip to content

Commit

Permalink
only support captureStackTrace for node
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Jan 17, 2024
1 parent dbbcb47 commit 104344d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
3 changes: 1 addition & 2 deletions src/errors/BaseError.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import { JS_ENV } from '../consts';
import { WindowChrome } from './types';

/**
* Errors that may be returned by the API.
Expand Down Expand Up @@ -80,7 +79,7 @@ export class BaseError extends Error {
super(message);
this.name = error || this.constructor.name;
// Only runtimes built on v8 will have `Error.captureStackTrace`.
if (JS_ENV === 'node' || (window && (window as WindowChrome).chrome)) {
if (JS_ENV === 'node') {
Error.captureStackTrace(this, this.constructor);
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/errors/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ export interface CheckXcmTxInputsOpts {
isLimited?: boolean;
weightLimit?: { refTime?: string; proofSize?: string };
}

export interface WindowChrome extends Window {
chrome?: unknown;
}

0 comments on commit 104344d

Please sign in to comment.