mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
alertOnError should default to true
Regressed in svelte-kit port
This commit is contained in:
parent
a1fa865bb2
commit
e66adcca38
1 changed files with 3 additions and 2 deletions
|
@ -10,7 +10,7 @@ export async function postProto<T>(
|
||||||
method: string,
|
method: string,
|
||||||
input: { toBinary(): Uint8Array; getType(): { typeName: string } },
|
input: { toBinary(): Uint8Array; getType(): { typeName: string } },
|
||||||
outputType: { fromBinary(arr: Uint8Array): T },
|
outputType: { fromBinary(arr: Uint8Array): T },
|
||||||
options: PostProtoOptions | undefined,
|
options: PostProtoOptions = {},
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
try {
|
try {
|
||||||
const inputBytes = input.toBinary();
|
const inputBytes = input.toBinary();
|
||||||
|
@ -18,7 +18,8 @@ export async function postProto<T>(
|
||||||
const outputBytes = await postProtoInner(path, inputBytes);
|
const outputBytes = await postProtoInner(path, inputBytes);
|
||||||
return outputType.fromBinary(outputBytes);
|
return outputType.fromBinary(outputBytes);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (options?.alertOnError && !(err instanceof Error && err.message === "500: Interrupted")) {
|
const { alertOnError = true } = options;
|
||||||
|
if (alertOnError && !(err instanceof Error && err.message === "500: Interrupted")) {
|
||||||
alert(err);
|
alert(err);
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
|
|
Loading…
Reference in a new issue