mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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,
|
stream,
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
window.captureException?.(e);
|
||||||
stopDownload();
|
stopDownload();
|
||||||
Notification.error(i18n('Download Error', [target.filename, e.toString()]));
|
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);
|
await download(`${name}.zip`, targets);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
window.captureException?.(e);
|
||||||
Notification.error(`${e.message} ${e.params?.[0]}`);
|
Notification.error(`${e.message} ${e.params?.[0]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ async function load() {
|
|||||||
try {
|
try {
|
||||||
await func(currentPageName, loadPage(1, type));
|
await func(currentPageName, loadPage(1, type));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
(window as any).captureException?.(e);
|
||||||
Notification.warn(`Failed to call '${type}Loading' of ${page.name}`);
|
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(`Failed to call '${type}Loading' of ${page.name}\n${e.stack}`);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.35.1",
|
"version": "4.35.2",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ async function handleClickUpload(files) {
|
|||||||
Notification.success(i18n('File uploaded successfully.'));
|
Notification.success(i18n('File uploaded successfully.'));
|
||||||
await pjax.request({ push: false });
|
await pjax.request({ push: false });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
window.captureException?.(e);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
Notification.error(i18n('File upload failed: {0}', e.toString()));
|
Notification.error(i18n('File upload failed: {0}', e.toString()));
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ const page = new NamedPage('problem_files', () => {
|
|||||||
Notification.success(i18n('File uploaded successfully.'));
|
Notification.success(i18n('File uploaded successfully.'));
|
||||||
await pjax.request({ push: false });
|
await pjax.request({ push: false });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
window.captureException?.(e);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
Notification.error(i18n('File upload failed: {0}', e.toString()));
|
Notification.error(i18n('File upload failed: {0}', e.toString()));
|
||||||
} finally {
|
} finally {
|
||||||
@@ -238,6 +239,7 @@ const page = new NamedPage('problem_files', () => {
|
|||||||
const res = await request.get(link);
|
const res = await request.get(link);
|
||||||
content = await request.get(res.url, undefined, { dataType: 'text' });
|
content = await request.get(res.url, undefined, { dataType: 'text' });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
window.captureException?.(e);
|
||||||
Notification.error(i18n('Failed to load file: {0}', e.message));
|
Notification.error(i18n('Failed to load file: {0}', e.message));
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user