Skip to content

Commit 2ac5c94

Browse files
Revert "Make OAuthError extend GenericError" (#646)
1 parent 5167b2e commit 2ac5c94

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

__mocks__/@auth0/auth0-spa-js.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,3 @@ export const Auth0Client = jest.fn(() => {
2727
logout,
2828
};
2929
});
30-
31-
export class GenericError extends Error {
32-
constructor(public error: string, public error_description: string) {
33-
super(error_description);
34-
Object.setPrototypeOf(this, GenericError.prototype);
35-
}
36-
}

src/errors.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import { GenericError } from "@auth0/auth0-spa-js";
2-
31
/**
42
* An OAuth2 error will come from the authorization server and will have at least an `error` property which will
53
* be the error code. And possibly an `error_description` property
64
*
75
* See: https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.3.1.2.6
86
*/
9-
export class OAuthError extends GenericError {
10-
constructor(error: string, error_description?: string) {
11-
super(error, error_description || error);
7+
export class OAuthError extends Error {
8+
constructor(public error: string, public error_description?: string) {
9+
super(error_description || error);
1210

1311
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
1412
Object.setPrototypeOf(this, OAuthError.prototype);

0 commit comments

Comments
 (0)