Skip to content

Commit

Permalink
Rename OpenIdServiceHttpError to its proper name
Browse files Browse the repository at this point in the history
We should call the file the same as the error type.
  • Loading branch information
spaceo committed Nov 5, 2023
1 parent 581f51f commit 94615ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/adgangsplatformen/fetcher.ts
Original file line number Diff line number Diff line change
@@ -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 <ResponseType>({
url,
Expand Down Expand Up @@ -36,7 +36,7 @@ export const fetcher = async <ResponseType>({
});

if (!response.ok) {
throw new OpenIdServiceHttpError(
throw new AdgangsPlatformenServiceHttpError(
response.status,
response.statusText,
url
Expand All @@ -51,13 +51,15 @@ export const fetcher = async <ResponseType>({
}
}
} 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 {};
Expand Down

0 comments on commit 94615ad

Please sign in to comment.