Skip to content

Commit e1b14cb

Browse files
committed
chore(base.html): Capture ajax error
1 parent e99cf41 commit e1b14cb

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/templates/base.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@
9393
dsn: "https://2e878ab38ea0468f870435702d667330@o1194684.ingest.sentry.io/6317549",
9494
environment: "{{ environment }}",
9595
});
96+
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
97+
Sentry.captureMessage(thrownError || jqXHR.statusText, {
98+
extra: {
99+
type: ajaxSettings.type,
100+
url: ajaxSettings.url,
101+
data: ajaxSettings.data,
102+
status: jqXHR.status,
103+
error: thrownError || jqXHR.statusText,
104+
response: jqXHR.responseText.substring(0, 100),
105+
},
106+
});
107+
});
96108
/* BootstrapDialog settings */
97109
BootstrapDialog.DEFAULT_TEXTS['OK'] = '確定';
98110
BootstrapDialog.DEFAULT_TEXTS['CANCEL'] = '取消';

0 commit comments

Comments
 (0)