From 92b728363ec1d77d80d5ea553975a0f11c87325a Mon Sep 17 00:00:00 2001 From: Sara Date: Wed, 8 Nov 2023 16:17:03 +0100 Subject: [PATCH] rename error util --- www/app/[domain]/transcripts/useMp3.ts | 4 ++-- www/app/[domain]/transcripts/useTopics.ts | 4 ++-- www/app/[domain]/transcripts/useTranscript.ts | 4 ++-- www/app/[domain]/transcripts/useWaveform.ts | 4 ++-- www/app/lib/errorUtils.ts | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/www/app/[domain]/transcripts/useMp3.ts b/www/app/[domain]/transcripts/useMp3.ts index 16470af3..c9506273 100644 --- a/www/app/[domain]/transcripts/useMp3.ts +++ b/www/app/[domain]/transcripts/useMp3.ts @@ -3,7 +3,7 @@ import { useError } from "../../(errors)/errorContext"; import { DomainContext } from "../domainContext"; import getApi from "../../lib/getApi"; import { useFiefAccessTokenInfo } from "@fief/fief/build/esm/nextjs/react"; -import { shouldShowGet } from "../../lib/errorUtils"; +import { shouldShowError } from "../../lib/errorUtils"; type Mp3Response = { url: string | null; @@ -61,7 +61,7 @@ const useMp3 = (protectedPath: boolean, id: string): Mp3Response => { }) .catch((err) => { setErrorState(err); - const shouldShowHuman = shouldShowGet(error); + const shouldShowHuman = shouldShowError(error); if (shouldShowHuman) { setError(err, "There was an error loading the audio"); } else { diff --git a/www/app/[domain]/transcripts/useTopics.ts b/www/app/[domain]/transcripts/useTopics.ts index 3efddeb4..01053019 100644 --- a/www/app/[domain]/transcripts/useTopics.ts +++ b/www/app/[domain]/transcripts/useTopics.ts @@ -6,7 +6,7 @@ import { import { useError } from "../../(errors)/errorContext"; import { Topic } from "./webSocketTypes"; import getApi from "../../lib/getApi"; -import { shouldShowGet } from "../../lib/errorUtils"; +import { shouldShowError } from "../../lib/errorUtils"; type TranscriptTopics = { topics: Topic[] | null; @@ -37,7 +37,7 @@ const useTopics = (protectedPath, id: string): TranscriptTopics => { }) .catch((err) => { setErrorState(err); - const shouldShowHuman = shouldShowGet(err); + const shouldShowHuman = shouldShowError(err); if (shouldShowHuman) { setError(err, "There was an error loading the topics"); } else { diff --git a/www/app/[domain]/transcripts/useTranscript.ts b/www/app/[domain]/transcripts/useTranscript.ts index 9b923353..7d52429c 100644 --- a/www/app/[domain]/transcripts/useTranscript.ts +++ b/www/app/[domain]/transcripts/useTranscript.ts @@ -3,7 +3,7 @@ import { V1TranscriptGetRequest } from "../../api/apis/DefaultApi"; import { GetTranscript } from "../../api"; import { useError } from "../../(errors)/errorContext"; import getApi from "../../lib/getApi"; -import { shouldShowGet } from "../../lib/errorUtils"; +import { shouldShowError } from "../../lib/errorUtils"; type Transcript = { response: GetTranscript | null; @@ -36,7 +36,7 @@ const useTranscript = ( console.debug("Transcript Loaded:", result); }) .catch((error) => { - const shouldShowHuman = shouldShowGet(error); + const shouldShowHuman = shouldShowError(error); console.log({ ...error }); if (shouldShowHuman) { setError(error, "There was an error loading the transcript"); diff --git a/www/app/[domain]/transcripts/useWaveform.ts b/www/app/[domain]/transcripts/useWaveform.ts index 9a450708..e0b98cc2 100644 --- a/www/app/[domain]/transcripts/useWaveform.ts +++ b/www/app/[domain]/transcripts/useWaveform.ts @@ -6,7 +6,7 @@ import { import { AudioWaveform } from "../../api"; import { useError } from "../../(errors)/errorContext"; import getApi from "../../lib/getApi"; -import { shouldShowGet } from "../../lib/errorUtils"; +import { shouldShowError } from "../../lib/errorUtils"; type AudioWaveFormResponse = { waveform: AudioWaveform | null; @@ -37,7 +37,7 @@ const useWaveform = (protectedPath, id: string): AudioWaveFormResponse => { }) .catch((err) => { setErrorState(err); - const shouldShowHuman = shouldShowGet(err); + const shouldShowHuman = shouldShowError(err); if (shouldShowHuman) { setError(err, "There was an error loading the waveform"); } else { diff --git a/www/app/lib/errorUtils.ts b/www/app/lib/errorUtils.ts index a6056c79..6455cd75 100644 --- a/www/app/lib/errorUtils.ts +++ b/www/app/lib/errorUtils.ts @@ -1,7 +1,7 @@ -function shouldShowGet(error: Error | null | undefined) { +function shouldShowError(error: Error | null | undefined) { if (error?.name == "ResponseError" && error["response"].status == 404) return false; return true; } -export { shouldShowGet }; +export { shouldShowError };