Skip to content

Commit dff38d1

Browse files
committed
refactor: use shared isAbortError utility in AuthTokenModal
Replace two inline `error instanceof DOMException && error.name === "AbortError"` checks with the existing shared `isAbortError()` utility from `@/browser/utils/isAbortError`. The shared utility is a superset that handles any Error with name "AbortError" (including DOMException), so behavior is preserved.
1 parent a0f0d32 commit dff38d1

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/browser/components/AuthTokenModal/AuthTokenModal.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import { Button } from "@/browser/components/Button/Button";
1212
import { getBrowserBackendBaseUrl } from "@/browser/utils/backendBaseUrl";
1313
import { getErrorMessage } from "@/common/utils/errors";
14+
import { isAbortError } from "@/browser/utils/isAbortError";
1415

1516
interface AuthTokenModalProps {
1617
isOpen: boolean;
@@ -136,8 +137,7 @@ export function AuthTokenModal(props: AuthTokenModalProps) {
136137
return;
137138
}
138139

139-
const isAbortError = error instanceof DOMException && error.name === "AbortError";
140-
if (!isAbortError) {
140+
if (!isAbortError(error)) {
141141
setGithubDeviceFlowEnabled(false);
142142
setGithubOptionsLoading(false);
143143
}
@@ -218,8 +218,7 @@ export function AuthTokenModal(props: AuthTokenModalProps) {
218218
clearStoredAuthToken();
219219
props.onSessionAuthenticated?.();
220220
} catch (error) {
221-
const isAbortError = error instanceof DOMException && error.name === "AbortError";
222-
if (isAbortError) {
221+
if (isAbortError(error)) {
223222
return;
224223
}
225224

0 commit comments

Comments
 (0)