mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -05:00
format post.ts to meet ninja check
This commit is contained in:
parent
63803e0ff3
commit
021d0cd968
1 changed files with 9 additions and 2 deletions
|
|
@ -19,7 +19,10 @@ export async function postProto<T>(
|
||||||
return outputType.fromBinary(outputBytes);
|
return outputType.fromBinary(outputBytes);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const { alertOnError = true } = options;
|
const { alertOnError = true } = options;
|
||||||
if (alertOnError && !(err instanceof Error && err.message === "500: Interrupted")) {
|
if (
|
||||||
|
alertOnError &&
|
||||||
|
!(err instanceof Error && err.message === "500: Interrupted")
|
||||||
|
) {
|
||||||
alert(err);
|
alert(err);
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
|
|
@ -42,7 +45,11 @@ async function postProtoInner(url: string, body: Uint8Array): Promise<Uint8Array
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
// it is ugly to show internall server client status to user, we should just show error's to user
|
// it is ugly to show internall server client status to user, we should just show error's to user
|
||||||
throw new Error(process.env.NODE_ENV === "production"?`${msg}`:`${result.status}: ${msg}`);
|
throw new Error(
|
||||||
|
process.env.NODE_ENV === "production"
|
||||||
|
? `${msg}`
|
||||||
|
: `${result.status}: ${msg}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const blob = await result.blob();
|
const blob = await result.blob();
|
||||||
const respBuf = await new Response(blob).arrayBuffer();
|
const respBuf = await new Response(blob).arrayBuffer();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue