Files
karma/assets/static/sentry.js
Łukasz Mierzwa 45ba69cf76 Ensure raven-js is loaded first and works if enabled
This moves raven init into a dedicated file where it's configured on load, we no longer load it on /help, but there's only css there so there wasn't anything that could fail anyway. We will also now fail in the most visible way if the value passed to raven is invalid (as in invalid syntax)
2017-04-25 23:05:22 -07:00

18 lines
451 B
JavaScript

var Sentry = (function() {
// init sentry client if sentry dsn is set
if ($("body").data("raven-dsn")) {
var dsn = $("body").data("raven-dsn").replace("\/", "/");
// raven itself can fail if invalid DSN is passed
try {
Raven.config(dsn, {
release: $("body").data("unsee-version")
}).install();
} catch (error) {
var msg = "Sentry error: " + error.message;
$("#raven-error").text(msg).removeClass("hidden");
}
}
})();