mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-03 14:19:58 +08:00
client-ts: Fix type error in server.ts
This commit is contained in:
parent
b7754bcea0
commit
90be9b28a8
@ -238,8 +238,10 @@ async function reportError(method: string, url: string, statusCode: number, resp
|
|||||||
|
|
||||||
const toastService = (await import("./toast.js")).default;
|
const toastService = (await import("./toast.js")).default;
|
||||||
|
|
||||||
|
const messageStr = (typeof message === "string" ? message : JSON.stringify(message));
|
||||||
|
|
||||||
if ([400, 404].includes(statusCode) && response && typeof response === 'object') {
|
if ([400, 404].includes(statusCode) && response && typeof response === 'object') {
|
||||||
toastService.showError(message);
|
toastService.showError(messageStr);
|
||||||
throw new ValidationError({
|
throw new ValidationError({
|
||||||
requestUrl: url,
|
requestUrl: url,
|
||||||
method,
|
method,
|
||||||
@ -248,7 +250,7 @@ async function reportError(method: string, url: string, statusCode: number, resp
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const title = `${statusCode} ${method} ${url}`;
|
const title = `${statusCode} ${method} ${url}`;
|
||||||
toastService.showErrorTitleAndMessage(title, message);
|
toastService.showErrorTitleAndMessage(title, messageStr);
|
||||||
toastService.throwError(`${title} - ${message}`);
|
toastService.throwError(`${title} - ${message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user