Skip to content

Commit

Permalink
Handles when captureStackTrace is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Oct 31, 2021
1 parent 1795f99 commit a9282cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/git/locator.ts
Expand Up @@ -6,15 +6,15 @@ export class UnableToFindGitError extends Error {
constructor(public readonly original?: Error) {
super('Unable to find git');

Error.captureStackTrace(this, UnableToFindGitError);
Error.captureStackTrace?.(this, UnableToFindGitError);
}
}

export class InvalidGitConfigError extends Error {
constructor(public readonly original: Error) {
super('Invalid Git configuration');

Error.captureStackTrace(this, InvalidGitConfigError);
Error.captureStackTrace?.(this, InvalidGitConfigError);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/git/remotes/provider.ts
Expand Up @@ -250,15 +250,15 @@ export class AuthenticationError extends Error {
constructor(private original: Error) {
super(original.message);

Error.captureStackTrace(this, AuthenticationError);
Error.captureStackTrace?.(this, AuthenticationError);
}
}

export class ClientError extends Error {
constructor(private original: Error) {
super(original.message);

Error.captureStackTrace(this, ClientError);
Error.captureStackTrace?.(this, ClientError);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/git/shell.ts
Expand Up @@ -151,7 +151,7 @@ export class RunError extends Error {

stdout = stdout.trim();
stderr = stderr.trim();
Error.captureStackTrace(this, RunError);
Error.captureStackTrace?.(this, RunError);
}

get cmd(): string | undefined {
Expand Down

0 comments on commit a9282cc

Please sign in to comment.