Skip to content

Commit 7b6d9d3

Browse files
committed
Make error name more specific.
1 parent abc1085 commit 7b6d9d3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/frontend/src/lib/utils/openID.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { fromBase64URL, toBase64URL } from "$lib/utils/utils";
77
import { Principal } from "@icp-sdk/core/principal";
88
import { isNullish, nonNullish } from "@dfinity/utils";
99
import {
10-
PopupClosedError,
10+
CallbackPopupClosedError,
1111
REDIRECT_CALLBACK_PATH,
1212
redirectInPopup,
1313
} from "../../routes/(new-styling)/callback/utils";
@@ -90,7 +90,7 @@ export const isNotSupportedError = (error: unknown) =>
9090
export const isOpenIdCancelError = (error: unknown) => {
9191
return (
9292
(error instanceof Error && error.name === "NetworkError") ||
93-
error instanceof PopupClosedError
93+
error instanceof CallbackPopupClosedError
9494
);
9595
};
9696

src/frontend/src/routes/(new-styling)/callback/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const BROADCAST_CHANNEL = "redirect_callback";
22
export const REDIRECT_CALLBACK_PATH = "/callback";
33

4-
export class PopupClosedError extends Error {}
4+
export class CallbackPopupClosedError extends Error {}
55

66
export const redirectInPopup = (url: string): Promise<string> => {
77
const width = 500;
@@ -22,7 +22,7 @@ export const redirectInPopup = (url: string): Promise<string> => {
2222
const closeInterval = setInterval(() => {
2323
if (redirectWindow?.closed === true) {
2424
clearInterval(closeInterval);
25-
reject(new PopupClosedError());
25+
reject(new CallbackPopupClosedError());
2626
}
2727
}, 500);
2828
// Listen to the popup, we expect a message with the url of the callback,

0 commit comments

Comments
 (0)