mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: support window.captureException
This commit is contained in:
1 parent
87b980f87d
commit
cad010482b
5 files changed
+7
-1
No files matched your search
@@ -51,6 +51,7 @@ export default async function download(filename, targets) {
|
||||
stream,
|
||||
};
|
||||
} catch (e) {
|
||||
window.captureException?.(e);
|
||||
stopDownload();
|
||||
Notification.error(i18n('Download Error', [target.filename, e.toString()]));
|
||||
}
|
||||
@@ -144,6 +145,7 @@ export async function downloadProblemSet(pids, name = 'Export') {
|
||||
}
|
||||
await download(`${name}.zip`, targets);
|
||||
} catch (e) {
|
||||
window.captureException?.(e);
|
||||
Notification.error(`${e.message} ${e.params?.[0]}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ async function load() {
|
||||
try {
|
||||
await func(currentPageName, loadPage(1, type));
|
||||
} catch (e) {
|
||||
(window as any).captureException?.(e);
|
||||
Notification.warn(`Failed to call '${type}Loading' of ${page.name}`);
|
||||
console.error(`Failed to call '${type}Loading' of ${page.name}\n${e.stack}`);
|
||||
console.error(e);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.35.1",
|
||||
"version": "4.35.2",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
@@ -88,6 +88,7 @@ async function handleClickUpload(files) {
|
||||
Notification.success(i18n('File uploaded successfully.'));
|
||||
await pjax.request({ push: false });
|
||||
} catch (e) {
|
||||
window.captureException?.(e);
|
||||
console.error(e);
|
||||
Notification.error(i18n('File upload failed: {0}', e.toString()));
|
||||
} finally {
|
||||
|
||||
@@ -100,6 +100,7 @@ const page = new NamedPage('problem_files', () => {
|
||||
Notification.success(i18n('File uploaded successfully.'));
|
||||
await pjax.request({ push: false });
|
||||
} catch (e) {
|
||||
window.captureException?.(e);
|
||||
console.error(e);
|
||||
Notification.error(i18n('File upload failed: {0}', e.toString()));
|
||||
} finally {
|
||||
@@ -238,6 +239,7 @@ const page = new NamedPage('problem_files', () => {
|
||||
const res = await request.get(link);
|
||||
content = await request.get(res.url, undefined, { dataType: 'text' });
|
||||
} catch (e) {
|
||||
window.captureException?.(e);
|
||||
Notification.error(i18n('Failed to load file: {0}', e.message));
|
||||
throw e;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user