UserScript: Fix fetch().res.ok

This commit is contained in:
V 2023-05-15 02:49:34 +02:00
parent 53ff2532f4
commit 2815509c00
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
2 changed files with 20 additions and 55 deletions

View file

@ -59,7 +59,7 @@ export async function translate(kind: "received" | "sent", text: string): Promis
const res = await fetch(url);
if (!res.ok)
throw new Error(
`Failed to translate "${text}" (${sourceLang} -> ${targetLang}`
`Failed to translate "${text}" (${sourceLang} -> ${targetLang})`
+ `\n${res.status} ${res.statusText}`
);