Skip to content

Commit

Permalink
fix: use Object.setPrototypeOf to override ErrorInfo prototype
Browse files Browse the repository at this point in the history
this has very minor side effect of breaking 403 authUrl handling for
IE < 11. I think it's still worth it.

see: https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
  • Loading branch information
owenpearson committed Feb 23, 2023
1 parent 75bc3ab commit 59aca8c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/common/lib/types/errorinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export default class ErrorInfo extends Error {

constructor(message: string, code: number | null, statusCode?: number, cause?: string | Error | ErrorInfo) {
super(message);
if (typeof Object.setPrototypeOf !== 'undefined') {
Object.setPrototypeOf(this, ErrorInfo.prototype);
}
this.code = code;
this.statusCode = statusCode;
this.cause = cause;
Expand Down

0 comments on commit 59aca8c

Please sign in to comment.