fix(tidarr): network error message (#280)

This commit is contained in:
cl.st authored and GitHub committed 2026-04-28 18:18:54 +02:00
1 parent 5bfd54ab2c
commit 1e369a09fb
3 files changed
+15 -13

No files matched your search

+1 -1
View File
@@ -33,5 +33,5 @@
]
}
],
"minSdkVersionForDexing": 35
"minSdkVersionForDexing": 24
}
+1 -4
View File
@@ -24,10 +24,7 @@
})();
</script>
<!-- End Matomo Code -->
<script type="module" crossorigin src="/assets/index-D7VFqCwT.js"></script>
<link rel="modulepreload" crossorigin href="/assets/definitions-DpxdDAAq.js">
<link rel="modulepreload" crossorigin href="/assets/dist-DtWIdkI-.js">
<link rel="modulepreload" crossorigin href="/assets/definitions-DT1Amp_1.js">
<script type="module" crossorigin src="/assets/index-BocVoKV2.js"></script>
</head>
<body>
+13 -8
View File
@@ -39,14 +39,19 @@ async function request<T>(
path: string,
options: RequestInit = {}
): Promise<T> {
const res = await fetch(`${config.url.replace(/\/$/, "")}${path}`, {
...options,
headers: {
"Content-Type": "application/json",
"X-Api-Key": config.apiKey,
...(options.headers ?? {}),
},
});
let res: Response;
try {
res = await fetch(`${config.url.replace(/\/$/, "")}${path}`, {
...options,
headers: {
"Content-Type": "application/json",
"X-Api-Key": config.apiKey,
...(options.headers ?? {}),
},
});
} catch {
throw new Error("Tidarr unreachable");
}
const contentType = res.headers.get("content-type") ?? "";
if (!res.ok) {
const body = contentType.includes("application/json") ? await res.text() : "";