mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
universe_wsgi.ini, then: - A middleware will be installed that send thrown exceptions to sentry - All logging messages of level WARN and above will be sent to sentry - All pages extending base/base_panels will have javascript errors captured and sent to sentry
1 line
3.5 KiB
JavaScript
1 line
3.5 KiB
JavaScript
(function(){var x=window.Raven,u=!h(window.JSON),e,o,p,q,f={logger:"javascript",ignoreErrors:[],ignoreUrls:[]};var z=TraceKit.noConflict();z.remoteFetching=false;var n={VERSION:"@VERSION",noConflict:function(){window.Raven=x;return n},config:function(C,B){var D=v(C),A=D.path.lastIndexOf("/"),E=D.path.substr(1,A);if(B){j(B,function(F,G){f[F]=G})}f.ignoreErrors.push("Script error.");p=D.user;q=~~D.path.substr(A+1);e=D.protocol+"://"+D.host+(D.port?":"+D.port:"")+"/"+E+"api/"+q+"/store/";if(f.fetchContext){z.remoteFetching=true}return n},install:function(){if(!s()){return}z.report.subscribe(m);return n},context:function(B,C,A){if(c(B)){A=C;C=B;B=undefined}n.wrap(B,C).apply(this,A)},wrap:function(A,B){if(c(A)){B=A;A=undefined}return function(){try{B.apply(this,arguments)}catch(C){n.captureException(C,A)}}},uninstall:function(){z.report.unsubscribe(m);return n},captureException:function(B,A){try{z.report(B,A)}catch(C){if(B!==C){throw C}}return n},captureMessage:function(B,A){l(r({message:B},A));return n},setUser:function(A){o=A;return n}};var b="source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),a=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;function v(D){var A=a.exec(D),C={},B=14;while(B--){C[b[B]]=A[B]||""}return C}function h(A){return typeof A==="undefined"}function c(A){return typeof A==="function"}function j(C,D){var B,A;if(C.length===undefined){for(B in C){if(C.hasOwnProperty(B)){D.call(null,B,C[B])}}}else{for(B=0,A=C.length;B<A;B++){D.call(null,B,C[B])}}}var g;function d(){if(g){return g}var A=["sentry_version=2.0","sentry_client=raven-js/"+n.VERSION];if(p){A.push("sentry_key="+p)}g="?"+A.join("&");return g}function m(D,B){var F=[],C=0,A=D.stack&&D.stack.length||0,E;for(;C<A;C++){E=k(D.stack[C]);if(E){F.push(E)}}i(D.name,D.message,D.url,D.lineno,F,B)}function k(E){if(!E.url){return}var D={filename:E.url,lineno:E.line,colno:E.column,"function":E.func||"?"},B=w(E);if(B){var A=3,C=["pre_context","context_line","post_context"];while(A--){D[C[A]]=B[A]}}D.in_app=!/(Raven|TraceKit)\./.test(D["function"]);return D}function w(E){if(!E.context||!f.fetchContext){return}var C=E.context,A=~~(C.length/2),B=C.length,D=false;while(B--){if(C[B].length>300){D=true;break}}if(D){if(h(E.column)){return}return[[],C[A].substr(E.column,50),[]]}return[C.slice(0,A),C[A],C.slice(A+1)]}function i(D,H,F,A,C,I){var G,E,B;B=f.ignoreErrors.length;while(B--){if(H===f.ignoreErrors[B]){return}}if(C&&C.length){G={frames:C};F=F||C[0].filename}else{if(F){G={frames:[{filename:F,lineno:A}]}}}B=f.ignoreUrls.length;while(B--){if(f.ignoreUrls[B].test(F)){return}}E=A?H+" at "+A:H;l(r({"sentry.interfaces.Exception":{type:D,value:H},"sentry.interfaces.Stacktrace":G,culprit:F,message:E},I))}function r(B,A){if(!A){return B}j(A,function(C,D){B[C]=D});return B}function y(){var A={url:window.location.href,headers:{"User-Agent":navigator.userAgent}};if(window.document.referrer){A.headers.Referer=window.document.referrer}return A}function l(A){if(!s()){return}A=r({project:q,logger:f.logger,site:f.site,platform:"javascript","sentry.interfaces.Http":y()},A);if(o){A["sentry.interfaces.User"]=o}if(c(f.dataCallback)){A=f.dataCallback(A)}t(A)}function t(A){new Image().src=e+d()+"&sentry_data="+encodeURIComponent(JSON.stringify(A))}function s(){if(!u){return false}if(!e){console.error("Error: Raven has not been configured.");return false}return true}window.Raven=n})(); |