Skip to content

Commit 8f4b4e2

Browse files
committed
refactor: improve error handling in SiteMapErrorBoundary by incorporating isAxiosErrorResponse for enhanced type safety
1 parent 31d954d commit 8f4b4e2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • apps/ticket/src/app/(pages)/event/[eventId]/time-table/site-map/_clientBoundary/SiteMapErrorBoundary

apps/ticket/src/app/(pages)/event/[eventId]/time-table/site-map/_clientBoundary/SiteMapErrorBoundary/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ReactNode } from "react";
44

55
import { Button, Flex, Typography } from "@permit/design-system";
66
import { ErrorBoundary, ErrorHandler } from "@/shared/clientBoundary/ErrorBoundary";
7-
import { AxiosErrorResponse } from "@/shared/types/axioxError";
7+
import { AxiosErrorResponse, isAxiosErrorResponse } from "@/shared/types/axioxError";
88

99
type Props = {
1010
children: ReactNode;
@@ -43,5 +43,5 @@ const siteMapErrorHandlers: ErrorHandler[] = [
4343
];
4444

4545
const isSiteMapNotRegisteredError = (error: AxiosErrorResponse) => {
46-
return error.code === NOT_FOUND_SITE_MAP_ERROR_CODE;
46+
return isAxiosErrorResponse(error) && error.response?.data.code === NOT_FOUND_SITE_MAP_ERROR_CODE;
4747
};

0 commit comments

Comments
 (0)