diff --git a/src/core/adgangsplatformen/OpenIdServiceHttpError.ts b/src/core/adgangsplatformen/AdgangsPlatformenServiceHttpError.ts similarity index 100% rename from src/core/adgangsplatformen/OpenIdServiceHttpError.ts rename to src/core/adgangsplatformen/AdgangsPlatformenServiceHttpError.ts diff --git a/src/core/adgangsplatformen/fetcher.ts b/src/core/adgangsplatformen/fetcher.ts index 9d0e245420..8372a64dfa 100644 --- a/src/core/adgangsplatformen/fetcher.ts +++ b/src/core/adgangsplatformen/fetcher.ts @@ -1,6 +1,6 @@ import FetchFailedCriticalError from "../fetchers/FetchFailedCriticalError"; import { getToken, TOKEN_USER_KEY } from "../token"; -import OpenIdServiceHttpError from "./OpenIdServiceHttpError"; +import AdgangsPlatformenServiceHttpError from "./AdgangsPlatformenServiceHttpError"; export const fetcher = async ({ url, @@ -36,7 +36,7 @@ export const fetcher = async ({ }); if (!response.ok) { - throw new OpenIdServiceHttpError( + throw new AdgangsPlatformenServiceHttpError( response.status, response.statusText, url @@ -51,13 +51,15 @@ export const fetcher = async ({ } } } catch (error: unknown) { - if (error instanceof OpenIdServiceHttpError) { + if (error instanceof AdgangsPlatformenServiceHttpError) { throw error; } const message = error instanceof Error ? error.message : "Unknown error"; throw new FetchFailedCriticalError(message, url); } + + return null; }; export default {};