Skip to content

Commit

Permalink
fix(utils): make sure instanceof StrykerError works
Browse files Browse the repository at this point in the history
Remove es5 workarounds around `Error`, so `err instanceof StrykerError`
works
  • Loading branch information
nicojs committed Apr 19, 2020
1 parent e9e2b02 commit a9dea8c
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions packages/util/src/StrykerError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ import { errorToString } from './errors';
export default class StrykerError extends Error {
constructor(message: string, public readonly innerError?: Error) {
super(`${message}${innerError ? `. Inner error: ${errorToString(innerError)}` : ''}`);
Error.captureStackTrace(this, StrykerError);
// TS recommendation: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
Object.setPrototypeOf(this, StrykerError.prototype);
}
}

0 comments on commit a9dea8c

Please sign in to comment.