├── .babelrc ├── .gitignore ├── CONTRIBUTORS.md ├── README.md ├── dist ├── vue2-sentry.amd.js ├── vue2-sentry.cjs.js └── vue2-sentry.es.js ├── package.json ├── rollup.config.js └── src └── index.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ] 11 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 | Alan Ktquez - (https://github.com/ktquez) 4 | Mostafa Amiri - (https://github.com/amiri27) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue2-sentry 2 | 3 | Plugin Vue.js for error tracking with Sentry 4 | 5 | ## Sentry 6 | If you do not already have a [Sentry](https://sentry.io) account, you will need to create it to gain access to the panel and the `keys` to integrate your Vue.js application into Sentry and start tracking errors and logs. 7 | 8 | ## Usage 9 | 10 | ### NPM 11 | 12 | ```shell 13 | npm install vue2-sentry --save 14 | ``` 15 | 16 | In your src/main.js: 17 | 18 | ```javascript 19 | import Vue from 'vue' 20 | import App from './App.vue' 21 | import VueSentry from 'vue2-sentry' 22 | 23 | Vue.use(VueSentry, { 24 | key: 'your_public_key', 25 | project: 'your_project_ID', 26 | config: {} // Optional: custom config 27 | }) 28 | 29 | Vue.config.productionTip = false 30 | 31 | /* eslint-disable no-new */ 32 | new Vue({ 33 | el: '#app', 34 | render: h => h(App) 35 | }) 36 | ``` 37 | 38 | ## Explaining the properties 39 | 40 | When installing the plugin using `Vue.use` it is possible to define an object by passing the default settings and the keys needed to build the DSN communication and make the tracking work the errors. 41 | 42 | **key:** Here you put the public key available in your Sentry account. 43 | 44 | ```javascript 45 | key: 'your_public_key' 46 | ``` 47 | 48 | **project:** Each project created in the Sentry panel it generates a project ID, in this property you inform the ID of the project that you want to track. 49 | 50 | **config:** At the time of installation, you can set various properties for your application to manage in a custom way on your Sentry dashboard. You can find out which options are available through this link [config sentry](https://docs.sentry.io/clients/javascript/config/) 51 | 52 | ## How to use within components 53 | Thinking of the flexibility to customize and define some specific information with tags, userContext, among others. The plugin uses Raven (which is the official Sentry SDK) and integrates into the Vue prototype, making it available in its component. 54 | 55 | For example, in any Vue component 56 | ```vue 57 | ... 58 | 70 | ... 71 | ``` 72 | 73 | For more information on how to make the most of Sentry contexts, just go to this link [Context with Sentry](https://docs.sentry.io/learn/context/) 74 | 75 | ## Server-side rendering 76 | Vue2-sentry is supported in projects with server-side rendering, both in manual deployments and using other structures. 77 | 78 | If you are using [Nuxt.js](https://nuxtjs.org/), you can opt for this [nuxt-community/sentry-module](https://github.com/nuxt-community/sentry-module). 79 | 80 | If you want to use vue2-sentry, just follow the plugins installation tutorial in the Nuxt.js documentation, through [this link](https://nuxtjs.org/guide/plugins/) 81 | 82 | ## Environments 83 | vue2-sentry will track in all environments, but if you want to track only in production, you can use the Node environment variables to determine. 84 | 85 | **enable:** By default `true` and is optional, equivalent to all environments. 86 | 87 | *If you want to track only in production, you can use this example below.* 88 | 89 | ```javascript 90 | Vue.use(VueSentry, { 91 | enable: process.env.NODE_ENV === 'production', // Optional: default is true for (all environments) 92 | ... 93 | } 94 | ``` 95 | 96 | ## Available options 97 | 98 | Property | Description 99 | --------------- | ------------- 100 | enable | Enable plugin - `default: true` 101 | protocol | Protocol used, this can http or https - `default: https` 102 | key | The public and secret keys to authenticate the SDK 103 | server | The destination server - `default: sentry.io` 104 | project | The project ID which the authenticated user is bound to 105 | config | Add extra configuration 106 | 107 | 108 | ## Contributing 109 | - Check the open issues or open a new issue to start a discussion around your feature idea or the bug you found. 110 | 111 | - Fork repository, make changes, add your name and link in the authors session readme.md 112 | 113 | - Send a pull request 114 | 115 | If you want a faster communication, find me on [@ktquez](https://twitter.com/ktquez) 116 | 117 | > Thank you 118 | -------------------------------------------------------------------------------- /dist/vue2-sentry.amd.js: -------------------------------------------------------------------------------- 1 | define(function(){"use strict";function t(){return"undefined"==typeof document||null==document.location?"":document.location.href}function e(t){this.name="RavenConfigError",this.message=t}function r(){return+new Date}function n(t,e){return i(e)?function(r){return e(r,t)}:e}function a(){this._hasJSON=!("object"!=typeof JSON||!JSON.stringify),this._hasDocument=!o(A),this._hasNavigator=!o($),this._lastCapturedException=null,this._lastData=null,this._lastEventId=null,this._globalServer=null,this._globalKey=null,this._globalProject=null,this._globalContext={},this._globalOptions={logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],collectWindowErrors:!0,maxMessageLength:0,maxUrlLength:250,stackTraceLimit:50,autoBreadcrumbs:!0,instrument:!0,sampleRate:1},this._ignoreOnError=0,this._isRavenInstalled=!1,this._originalErrorStackTraceLimit=Error.stackTraceLimit,this._originalConsole=q.console||{},this._originalConsoleMethods={},this._plugins=[],this._startTime=r(),this._wrappedBuiltIns=[],this._breadcrumbs=[],this._lastCapturedEvent=null,this._keypressTimeout,this._location=q.location,this._lastHref=this._location&&this._location.href,this._resetBackoff();for(var t in this._originalConsole)this._originalConsoleMethods[t]=this._originalConsole[t]}function o(t){return void 0===t}function i(t){return"function"==typeof t}function s(t){return"[object String]"===W.toString.call(t)}function l(t){for(var e in t)return!1;return!0}function c(t,e){var r,n;if(o(t.length))for(r in t)p(t,r)&&e.call(null,r,t[r]);else if(n=t.length)for(r=0;r ".length;t&&n++<5&&!("html"===(e=b(t))||n>1&&a+r.length*o+e.length>=80);)r.push(e),a+=e.length,t=t.parentNode;return r.reverse().join(" > ")}function b(t){var e,r,n,a,o,i=[];if(!t||!t.tagName)return"";if(i.push(t.tagName.toLowerCase()),t.id&&i.push("#"+t.id),(e=t.className)&&s(e))for(r=e.split(/\s+/),o=0;o":"anonymous component")+(t._isVue&&t.$options.__file?" at "+t.$options.__file:"")}var S="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O={isObject:function(t){return"object"==typeof t&&null!==t},isError:function(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return t instanceof Error}},wrappedCallback:function(t){return function(e,r){var n=t(e)||e;return r?r(n)||n:n}}},C={collectWindowErrors:!0,debug:!1},R="undefined"!=typeof window?window:void 0!==S?S:"undefined"!=typeof self?self:{},T=[].slice,D="?",I=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;C.report=function(){function e(t,e){var r=null;if(!e||C.collectWindowErrors){for(var n in c)if(c.hasOwnProperty(n))try{c[n].apply(null,[t].concat(T.call(arguments,2)))}catch(t){r=t}if(r)throw r}}function r(r,n,a,i,l){if(f)C.computeStackTrace.augmentStackTraceWithInitialElement(f,n,a,r),o();else if(l&&O.isError(l))e(C.computeStackTrace(l),!0);else{var c,u={url:n,line:a,column:i},h=void 0,p=r;"[object String]"==={}.toString.call(r)&&(c=r.match(I))&&(h=c[1],p=c[2]),u.func=D,e({name:h,message:p,url:t(),stack:[u]},!0)}return!!s&&s.apply(this,arguments)}function n(){l||(s=R.onerror,R.onerror=r,l=!0)}function a(){l&&(R.onerror=s,l=!1,s=void 0)}function o(){var t=f,r=u;u=null,f=null,h=null,e.apply(null,[t,!1].concat(r))}function i(t,e){var r=T.call(arguments,1);if(f){if(h===t)return;o()}var n=C.computeStackTrace(t);if(f=n,h=t,u=r,setTimeout(function(){h===t&&o()},n.incomplete?2e3:0),!1!==e)throw t}var s,l,c=[],u=null,h=null,f=null;return i.subscribe=function(t){n(),c.push(t)},i.unsubscribe=function(t){for(var e=c.length-1;e>=0;--e)c[e]===t&&c.splice(e,1)},i.uninstall=function(){a(),c=[]},i}(),C.computeStackTrace=function(){function e(e){if(void 0!==e.stack&&e.stack){for(var r,n,a,o=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,i=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,l=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,u=e.stack.split("\n"),h=[],f=(/^(.*) is undefined$/.exec(e.message),0),p=u.length;f eval")>-1;g&&(r=l.exec(n[3]))?(n[3]=r[1],n[4]=r[2],n[5]=null):0!==f||n[5]||void 0===e.columnNumber||(h[0].column=e.columnNumber+1),a={url:n[3],func:n[1]||D,args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}!a.func&&a.line&&(a.func=D),h.push(a)}return h.length?{name:e.name,message:e.message,url:t(),stack:h}:null}}function r(t,e,r,n){var a={url:e,line:r};if(a.url&&a.line){if(t.incomplete=!1,a.func||(a.func=D),t.stack.length>0&&t.stack[0].url===a.url){if(t.stack[0].line===a.line)return!1;if(!t.stack[0].line&&t.stack[0].func===a.func)return t.stack[0].line=a.line,!1}return t.stack.unshift(a),t.partial=!0,!0}return t.incomplete=!0,!1}function n(e,o){for(var i,s,l=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,c=[],u={},h=!1,f=n.caller;f&&!h;f=f.caller)if(f!==a&&f!==C.report){if(s={url:null,func:D,line:null,column:null},f.name?s.func=f.name:(i=l.exec(f.toString()))&&(s.func=i[1]),void 0===s.func)try{s.func=i.input.substring(0,i.input.indexOf("{"))}catch(t){}u[""+f]?h=!0:u[""+f]=!0,c.push(s)}o&&c.splice(0,o);var p={name:e.name,message:e.message,url:t(),stack:c};return r(p,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),p}function a(r,a){var o=null;a=null==a?0:+a;try{if(o=e(r))return o}catch(t){if(C.debug)throw t}try{if(o=n(r,a+1))return o}catch(t){if(C.debug)throw t}return{name:r.name,message:r.message,url:t()}}return a.augmentStackTraceWithInitialElement=r,a.computeStackTraceFromStackProp=e,a}();var j=C,B=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){function r(t,e){for(var r=0;r0){var l=r(a,this);~l?a.splice(l+1):a.push(this),~l?o.splice(l,1/0,i):o.push(i),~r(a,s)&&(s=e.call(this,i,s))}else a.push(s);return null==t?s instanceof Error?n(s):s:t.call(this,i,s)}}(t.exports=function(t,e,r,n){return JSON.stringify(t,a(e,n),r)}).getSerialize=a});(e.prototype=new Error).constructor=e;var N=e,U={wrapMethod:function(t,e,r){var n=t[e],a=t;if(e in t){var o="warn"===e?"warning":e;t[e]=function(){var t=[].slice.call(arguments),i=""+t.join(" "),s={level:o,logger:"console",extra:{arguments:t}};"assert"===e?!1===t[0]&&(i="Assertion failed: "+(t.slice(1).join(" ")||"console.assert"),s.extra.arguments=t.slice(1),r&&r(i,s)):r&&r(i,s),n&&Function.prototype.apply.call(n,a,t)}}}},L=O.isError,H=O.isObject,P=U.wrapMethod,M="source protocol user pass host port path".split(" "),F=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/,q="undefined"!=typeof window?window:void 0!==S?S:"undefined"!=typeof self?self:{},A=q.document,$=q.navigator;a.prototype={VERSION:"3.18.1",debug:!1,TraceKit:j,config:function(t,e){var r=this;if(r._globalServer)return this._logDebug("error","Error: Raven has already been configured"),r;if(!t)return r;var n=r._globalOptions;e&&c(e,function(t,e){"tags"===t||"extra"===t||"user"===t?r._globalContext[t]=e:n[t]=e}),r.setDSN(t),n.ignoreErrors.push(/^Script error\.?$/),n.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),n.ignoreErrors=d(n.ignoreErrors),n.ignoreUrls=!!n.ignoreUrls.length&&d(n.ignoreUrls),n.whitelistUrls=!!n.whitelistUrls.length&&d(n.whitelistUrls),n.includePaths=d(n.includePaths),n.maxBreadcrumbs=Math.max(0,Math.min(n.maxBreadcrumbs||100,100));var a={xhr:!0,console:!0,dom:!0,location:!0},o=n.autoBreadcrumbs;"[object Object]"==={}.toString.call(o)?o=u(a,o):!1!==o&&(o=a),n.autoBreadcrumbs=o;var i={tryCatch:!0},s=n.instrument;return"[object Object]"==={}.toString.call(s)?s=u(i,s):!1!==s&&(s=i),n.instrument=s,j.collectWindowErrors=!!n.collectWindowErrors,r},install:function(){var t=this;return t.isSetup()&&!t._isRavenInstalled&&(j.report.subscribe(function(){t._handleOnErrorStackInfo.apply(t,arguments)}),t._globalOptions.instrument&&t._globalOptions.instrument.tryCatch&&t._instrumentTryCatch(),t._globalOptions.autoBreadcrumbs&&t._instrumentBreadcrumbs(),t._drainPlugins(),t._isRavenInstalled=!0),Error.stackTraceLimit=t._globalOptions.stackTraceLimit,this},setDSN:function(t){var e=this,r=e._parseDSN(t),n=r.path.lastIndexOf("/"),a=r.path.substr(1,n);e._dsn=t,e._globalKey=r.user,e._globalSecret=r.pass&&r.pass.substr(1),e._globalProject=r.path.substr(n+1),e._globalServer=e._getGlobalServer(r),e._globalEndpoint=e._globalServer+"/"+a+"api/"+e._globalProject+"/store/",this._resetBackoff()},context:function(t,e,r){return i(t)&&(r=e||[],e=t,t=void 0),this.wrap(t,e).apply(this,r)},wrap:function(t,e,r){function n(){var n=[],o=arguments.length,s=!t||t&&!1!==t.deep;for(r&&i(r)&&r.apply(this,arguments);o--;)n[o]=s?a.wrap(t,arguments[o]):arguments[o];try{return e.apply(this,n)}catch(e){throw a._ignoreNextOnError(),a.captureException(e,t),e}}var a=this;if(o(e)&&!i(t))return t;if(i(t)&&(e=t,t=void 0),!i(e))return e;try{if(e.__raven__)return e;if(e.__raven_wrapper__)return e.__raven_wrapper__}catch(t){return e}for(var s in e)p(e,s)&&(n[s]=e[s]);return n.prototype=e.prototype,e.__raven_wrapper__=n,n.__raven__=!0,n.__inner__=e,n},uninstall:function(){return j.report.uninstall(),this._restoreBuiltIns(),Error.stackTraceLimit=this._originalErrorStackTraceLimit,this._isRavenInstalled=!1,this},captureException:function(t,e){if(!L(t))return this.captureMessage(t,u({trimHeadFrames:1,stacktrace:!0},e));this._lastCapturedException=t;try{var r=j.computeStackTrace(t);this._handleStackInfo(r,e)}catch(e){if(t!==e)throw e}return this},captureMessage:function(t,e){if(!this._globalOptions.ignoreErrors.test||!this._globalOptions.ignoreErrors.test(t)){var r=u({message:t+""},e=e||{});if(this._globalOptions.stacktrace||e&&e.stacktrace){var n;try{throw new Error(t)}catch(t){n=t}n.name=null,e=u({fingerprint:t,trimHeadFrames:(e.trimHeadFrames||0)+1},e);var a=j.computeStackTrace(n),o=this._prepareFrames(a,e);r.stacktrace={frames:o.reverse()}}return this._send(r),this}},captureBreadcrumb:function(t){var e=u({timestamp:r()/1e3},t);if(i(this._globalOptions.breadcrumbCallback)){var n=this._globalOptions.breadcrumbCallback(e);if(H(n)&&!l(n))e=n;else if(!1===n)return this}return this._breadcrumbs.push(e),this._breadcrumbs.length>this._globalOptions.maxBreadcrumbs&&this._breadcrumbs.shift(),this},addPlugin:function(t){var e=[].slice.call(arguments,1);return this._plugins.push([t,e]),this._isRavenInstalled&&this._drainPlugins(),this},setUserContext:function(t){return this._globalContext.user=t,this},setExtraContext:function(t){return this._mergeContext("extra",t),this},setTagsContext:function(t){return this._mergeContext("tags",t),this},clearContext:function(){return this._globalContext={},this},getContext:function(){return JSON.parse(B(this._globalContext))},setEnvironment:function(t){return this._globalOptions.environment=t,this},setRelease:function(t){return this._globalOptions.release=t,this},setDataCallback:function(t){var e=this._globalOptions.dataCallback;return this._globalOptions.dataCallback=n(e,t),this},setBreadcrumbCallback:function(t){var e=this._globalOptions.breadcrumbCallback;return this._globalOptions.breadcrumbCallback=n(e,t),this},setShouldSendCallback:function(t){var e=this._globalOptions.shouldSendCallback;return this._globalOptions.shouldSendCallback=n(e,t),this},setTransport:function(t){return this._globalOptions.transport=t,this},lastException:function(){return this._lastCapturedException},lastEventId:function(){return this._lastEventId},isSetup:function(){return!!this._hasJSON&&(!!this._globalServer||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this._logDebug("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var t=q.RavenConfig;t&&this.config(t.dsn,t.config).install()},showReportDialog:function(t){if(A){var e=(t=t||{}).eventId||this.lastEventId();if(!e)throw new N("Missing eventId");var r=t.dsn||this._dsn;if(!r)throw new N("Missing DSN");var n=encodeURIComponent,a="";a+="?eventId="+n(e),a+="&dsn="+n(r);var o=t.user||this._globalContext.user;o&&(o.name&&(a+="&name="+n(o.name)),o.email&&(a+="&email="+n(o.email)));var i=this._getGlobalServer(this._parseDSN(r)),s=A.createElement("script");s.async=!0,s.src=i+"/api/embed/error-page/"+a,(A.head||A.body).appendChild(s)}},_ignoreNextOnError:function(){var t=this;this._ignoreOnError+=1,setTimeout(function(){t._ignoreOnError-=1})},_triggerEvent:function(t,e){var r,n;if(this._hasDocument){e=e||{},t="raven"+t.substr(0,1).toUpperCase()+t.substr(1),A.createEvent?(r=A.createEvent("HTMLEvents")).initEvent(t,!0,!0):(r=A.createEventObject()).eventType=t;for(n in e)p(e,n)&&(r[n]=e[n]);if(A.createEvent)A.dispatchEvent(r);else try{A.fireEvent("on"+r.eventType.toLowerCase(),r)}catch(t){}}},_breadcrumbEventHandler:function(t){var e=this;return function(r){if(e._keypressTimeout=null,e._lastCapturedEvent!==r){e._lastCapturedEvent=r;var n;try{n=m(r.target)}catch(t){n=""}e.captureBreadcrumb({category:"ui."+t,message:n})}}},_keypressEventHandler:function(){var t=this;return function(e){var r;try{r=e.target}catch(t){return}var n=r&&r.tagName;if(n&&("INPUT"===n||"TEXTAREA"===n||r.isContentEditable)){var a=t._keypressTimeout;a||t._breadcrumbEventHandler("input")(e),clearTimeout(a),t._keypressTimeout=setTimeout(function(){t._keypressTimeout=null},1e3)}}},_captureUrlChange:function(t,e){var r=_(this._location.href),n=_(e),a=_(t);this._lastHref=e,r.protocol===n.protocol&&r.host===n.host&&(e=n.relative),r.protocol===a.protocol&&r.host===a.host&&(t=a.relative),this.captureBreadcrumb({category:"navigation",data:{to:e,from:t}})},_instrumentTryCatch:function(){function t(t){return function(r,n){for(var a=new Array(arguments.length),o=0;o2?arguments[2]:void 0;return r&&e._captureUrlChange(e._lastHref,r+""),t.apply(this,arguments)}},n)}if(r.console&&"console"in q&&console.log){var h=function(t,r){e.captureBreadcrumb({message:t,level:r.level,category:"console"})};c(["debug","info","warn","error","log"],function(t,e){P(console,e,h)})}},_restoreBuiltIns:function(){for(var t;this._wrappedBuiltIns.length;){var e=(t=this._wrappedBuiltIns.shift())[0],r=t[1],n=t[2];e[r]=n}},_drainPlugins:function(){var t=this;c(this._plugins,function(e,r){var n=r[0],a=r[1];n.apply(t,[t].concat(a))})},_parseDSN:function(t){var e=F.exec(t),r={},n=7;try{for(;n--;)r[M[n]]=e[n]||""}catch(e){throw new N("Invalid DSN: "+t)}if(r.pass&&!this._globalOptions.allowSecretKey)throw new N("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return r},_getGlobalServer:function(t){var e="//"+t.host+(t.port?":"+t.port:"");return t.protocol&&(e=t.protocol+":"+e),e},_handleOnErrorStackInfo:function(){this._ignoreOnError||this._handleStackInfo.apply(this,arguments)},_handleStackInfo:function(t,e){var r=this._prepareFrames(t,e);this._triggerEvent("handle",{stackInfo:t,options:e}),this._processException(t.name,t.message,t.url,t.lineno,r,e)},_prepareFrames:function(t,e){var r=this,n=[];if(t.stack&&t.stack.length&&(c(t.stack,function(e,a){var o=r._normalizeFrame(a,t.url);o&&n.push(o)}),e&&e.trimHeadFrames))for(var a=0;a0&&(t.breadcrumbs={values:[].slice.call(this._breadcrumbs,0)}),l(t.tags)&&delete t.tags,this._globalContext.user&&(t.user=this._globalContext.user),e.environment&&(t.environment=e.environment),e.release&&(t.release=e.release),e.serverName&&(t.server_name=e.serverName),i(e.dataCallback)&&(t=e.dataCallback(t)||t),t&&!l(t)&&(i(e.shouldSendCallback)&&!e.shouldSendCallback(t)||(this._shouldBackoff()?this._logDebug("warn","Raven dropped error due to backoff: ",t):"number"==typeof e.sampleRate?Math.random() ".length;e&&r++<5&&!("html"===(t=htmlElementAsString(e))||r>1&&o+n.length*a+t.length>=80);)n.push(t),o+=t.length,e=e.parentNode;return n.reverse().join(" > ")}function htmlElementAsString(e){var t,n,r,o,a,i=[];if(!e||!e.tagName)return"";if(i.push(e.tagName.toLowerCase()),e.id&&i.push("#"+e.id),(t=e.className)&&isString(t))for(n=t.split(/\s+/),a=0;a":"anonymous component")+(e._isVue&&e.$options.__file?" at "+e.$options.__file:"")}function vuePlugin(e,t){if((t=t||window.Vue)&&t.config){var n=t.config.errorHandler;t.config.errorHandler=function(t,r,o){var a={componentName:formatComponentName(r),propsData:r.$options.propsData};void 0!==o&&(a.lifecycleHook=o),e.captureException(t,{extra:a}),"function"==typeof n&&n.call(this,t,r,o)}}}function VueSentry(e,t){var n={enable:!0};t&&(t=_extends({},n,t)),t.enable&&(singleton.config((t.protocol||"https")+"://"+t.key+"@"+(t.server||"sentry.io")+"/"+t.project,_extends({},t.config)).addPlugin(vue,e).install(),e.prototype.$raven=singleton)}var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},utils={isObject:isObject$1,isError:isError$1,wrappedCallback:wrappedCallback},TraceKit={collectWindowErrors:!0,debug:!1},_window$2="undefined"!=typeof window?window:void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{},_slice=[].slice,UNKNOWN_FUNCTION="?",ERROR_TYPES_RE=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;TraceKit.report=function(){function e(e,t){var n=null;if(!t||TraceKit.collectWindowErrors){for(var r in l)if(l.hasOwnProperty(r))try{l[r].apply(null,[e].concat(_slice.call(arguments,2)))}catch(e){n=e}if(n)throw n}}function t(t,n,r,a,s){if(f)TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(f,n,r,t),o();else if(s&&utils.isError(s))e(TraceKit.computeStackTrace(s),!0);else{var l,c={url:n,line:r,column:a},u=void 0,h=t;"[object String]"==={}.toString.call(t)&&(l=t.match(ERROR_TYPES_RE))&&(u=l[1],h=l[2]),c.func=UNKNOWN_FUNCTION,e({name:u,message:h,url:getLocationHref(),stack:[c]},!0)}return!!i&&i.apply(this,arguments)}function n(){s||(i=_window$2.onerror,_window$2.onerror=t,s=!0)}function r(){s&&(_window$2.onerror=i,s=!1,i=void 0)}function o(){var t=f,n=c;c=null,f=null,u=null,e.apply(null,[t,!1].concat(n))}function a(e,t){var n=_slice.call(arguments,1);if(f){if(u===e)return;o()}var r=TraceKit.computeStackTrace(e);if(f=r,u=e,c=n,setTimeout(function(){u===e&&o()},r.incomplete?2e3:0),!1!==t)throw e}var i,s,l=[],c=null,u=null,f=null;return a.subscribe=function(e){n(),l.push(e)},a.unsubscribe=function(e){for(var t=l.length-1;t>=0;--t)l[t]===e&&l.splice(t,1)},a.uninstall=function(){r(),l=[]},a}(),TraceKit.computeStackTrace=function(){function e(e){if(void 0!==e.stack&&e.stack){for(var t,n,r,o=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,i=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,s=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,l=/\((\S*)(?::(\d+))(?::(\d+))\)/,c=e.stack.split("\n"),u=[],f=(/^(.*) is undefined$/.exec(e.message),0),h=c.length;f eval")>-1;d&&(t=s.exec(n[3]))?(n[3]=t[1],n[4]=t[2],n[5]=null):0!==f||n[5]||void 0===e.columnNumber||(u[0].column=e.columnNumber+1),r={url:n[3],func:n[1]||UNKNOWN_FUNCTION,args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}!r.func&&r.line&&(r.func=UNKNOWN_FUNCTION),u.push(r)}return u.length?{name:e.name,message:e.message,url:getLocationHref(),stack:u}:null}}function t(e,t,n,r){var o={url:t,line:n};if(o.url&&o.line){if(e.incomplete=!1,o.func||(o.func=UNKNOWN_FUNCTION),e.stack.length>0&&e.stack[0].url===o.url){if(e.stack[0].line===o.line)return!1;if(!e.stack[0].line&&e.stack[0].func===o.func)return e.stack[0].line=o.line,!1}return e.stack.unshift(o),e.partial=!0,!0}return e.incomplete=!0,!1}function n(e,o){for(var a,i,s=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,l=[],c={},u=!1,f=n.caller;f&&!u;f=f.caller)if(f!==r&&f!==TraceKit.report){if(i={url:null,func:UNKNOWN_FUNCTION,line:null,column:null},f.name?i.func=f.name:(a=s.exec(f.toString()))&&(i.func=a[1]),void 0===i.func)try{i.func=a.input.substring(0,a.input.indexOf("{"))}catch(e){}c[""+f]?u=!0:c[""+f]=!0,l.push(i)}o&&l.splice(0,o);var h={name:e.name,message:e.message,url:getLocationHref(),stack:l};return t(h,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),h}function r(t,r){var o=null;r=null==r?0:+r;try{if(o=e(t))return o}catch(e){if(TraceKit.debug)throw e}try{if(o=n(t,r+1))return o}catch(e){if(TraceKit.debug)throw e}return{name:t.name,message:t.message,url:getLocationHref()}}return r.augmentStackTraceWithInitialElement=t,r.computeStackTraceFromStackProp=e,r}();var tracekit=TraceKit,stringify_1=createCommonjsModule(function(e,t){function n(e,t){for(var n=0;n0){var l=n(o,this);~l?o.splice(l+1):o.push(this),~l?a.splice(l,1/0,i):a.push(i),~n(o,s)&&(s=t.call(this,i,s))}else o.push(s);return null==e?s instanceof Error?r(s):s:e.call(this,i,s)}}(e.exports=function(e,t,n,r){return JSON.stringify(e,o(t,r),n)}).getSerialize=o});RavenConfigError.prototype=new Error,RavenConfigError.prototype.constructor=RavenConfigError;var configError=RavenConfigError,wrapMethod=function(e,t,n){var r=e[t],o=e;if(t in e){var a="warn"===t?"warning":t;e[t]=function(){var e=[].slice.call(arguments),i=""+e.join(" "),s={level:a,logger:"console",extra:{arguments:e}};"assert"===t?!1===e[0]&&(i="Assertion failed: "+(e.slice(1).join(" ")||"console.assert"),s.extra.arguments=e.slice(1),n&&n(i,s)):n&&n(i,s),r&&Function.prototype.apply.call(r,o,e)}}},console$1={wrapMethod:wrapMethod},isError=utils.isError,isObject=utils.isObject,wrapConsoleMethod=console$1.wrapMethod,dsnKeys="source protocol user pass host port path".split(" "),dsnPattern=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/,_window$1="undefined"!=typeof window?window:void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{},_document=_window$1.document,_navigator=_window$1.navigator;Raven$2.prototype={VERSION:"3.18.1",debug:!1,TraceKit:tracekit,config:function(e,t){var n=this;if(n._globalServer)return this._logDebug("error","Error: Raven has already been configured"),n;if(!e)return n;var r=n._globalOptions;t&&each(t,function(e,t){"tags"===e||"extra"===e||"user"===e?n._globalContext[e]=t:r[e]=t}),n.setDSN(e),r.ignoreErrors.push(/^Script error\.?$/),r.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),r.ignoreErrors=joinRegExp(r.ignoreErrors),r.ignoreUrls=!!r.ignoreUrls.length&&joinRegExp(r.ignoreUrls),r.whitelistUrls=!!r.whitelistUrls.length&&joinRegExp(r.whitelistUrls),r.includePaths=joinRegExp(r.includePaths),r.maxBreadcrumbs=Math.max(0,Math.min(r.maxBreadcrumbs||100,100));var o={xhr:!0,console:!0,dom:!0,location:!0},a=r.autoBreadcrumbs;"[object Object]"==={}.toString.call(a)?a=objectMerge(o,a):!1!==a&&(a=o),r.autoBreadcrumbs=a;var i={tryCatch:!0},s=r.instrument;return"[object Object]"==={}.toString.call(s)?s=objectMerge(i,s):!1!==s&&(s=i),r.instrument=s,tracekit.collectWindowErrors=!!r.collectWindowErrors,n},install:function(){var e=this;return e.isSetup()&&!e._isRavenInstalled&&(tracekit.report.subscribe(function(){e._handleOnErrorStackInfo.apply(e,arguments)}),e._globalOptions.instrument&&e._globalOptions.instrument.tryCatch&&e._instrumentTryCatch(),e._globalOptions.autoBreadcrumbs&&e._instrumentBreadcrumbs(),e._drainPlugins(),e._isRavenInstalled=!0),Error.stackTraceLimit=e._globalOptions.stackTraceLimit,this},setDSN:function(e){var t=this,n=t._parseDSN(e),r=n.path.lastIndexOf("/"),o=n.path.substr(1,r);t._dsn=e,t._globalKey=n.user,t._globalSecret=n.pass&&n.pass.substr(1),t._globalProject=n.path.substr(r+1),t._globalServer=t._getGlobalServer(n),t._globalEndpoint=t._globalServer+"/"+o+"api/"+t._globalProject+"/store/",this._resetBackoff()},context:function(e,t,n){return isFunction(e)&&(n=t||[],t=e,e=void 0),this.wrap(e,t).apply(this,n)},wrap:function(e,t,n){function r(){var r=[],a=arguments.length,i=!e||e&&!1!==e.deep;for(n&&isFunction(n)&&n.apply(this,arguments);a--;)r[a]=i?o.wrap(e,arguments[a]):arguments[a];try{return t.apply(this,r)}catch(t){throw o._ignoreNextOnError(),o.captureException(t,e),t}}var o=this;if(isUndefined(t)&&!isFunction(e))return e;if(isFunction(e)&&(t=e,e=void 0),!isFunction(t))return t;try{if(t.__raven__)return t;if(t.__raven_wrapper__)return t.__raven_wrapper__}catch(e){return t}for(var a in t)hasKey(t,a)&&(r[a]=t[a]);return r.prototype=t.prototype,t.__raven_wrapper__=r,r.__raven__=!0,r.__inner__=t,r},uninstall:function(){return tracekit.report.uninstall(),this._restoreBuiltIns(),Error.stackTraceLimit=this._originalErrorStackTraceLimit,this._isRavenInstalled=!1,this},captureException:function(e,t){if(!isError(e))return this.captureMessage(e,objectMerge({trimHeadFrames:1,stacktrace:!0},t));this._lastCapturedException=e;try{var n=tracekit.computeStackTrace(e);this._handleStackInfo(n,t)}catch(t){if(e!==t)throw t}return this},captureMessage:function(e,t){if(!this._globalOptions.ignoreErrors.test||!this._globalOptions.ignoreErrors.test(e)){var n=objectMerge({message:e+""},t=t||{});if(this._globalOptions.stacktrace||t&&t.stacktrace){var r;try{throw new Error(e)}catch(e){r=e}r.name=null,t=objectMerge({fingerprint:e,trimHeadFrames:(t.trimHeadFrames||0)+1},t);var o=tracekit.computeStackTrace(r),a=this._prepareFrames(o,t);n.stacktrace={frames:a.reverse()}}return this._send(n),this}},captureBreadcrumb:function(e){var t=objectMerge({timestamp:now()/1e3},e);if(isFunction(this._globalOptions.breadcrumbCallback)){var n=this._globalOptions.breadcrumbCallback(t);if(isObject(n)&&!isEmptyObject(n))t=n;else if(!1===n)return this}return this._breadcrumbs.push(t),this._breadcrumbs.length>this._globalOptions.maxBreadcrumbs&&this._breadcrumbs.shift(),this},addPlugin:function(e){var t=[].slice.call(arguments,1);return this._plugins.push([e,t]),this._isRavenInstalled&&this._drainPlugins(),this},setUserContext:function(e){return this._globalContext.user=e,this},setExtraContext:function(e){return this._mergeContext("extra",e),this},setTagsContext:function(e){return this._mergeContext("tags",e),this},clearContext:function(){return this._globalContext={},this},getContext:function(){return JSON.parse(stringify_1(this._globalContext))},setEnvironment:function(e){return this._globalOptions.environment=e,this},setRelease:function(e){return this._globalOptions.release=e,this},setDataCallback:function(e){var t=this._globalOptions.dataCallback;return this._globalOptions.dataCallback=keepOriginalCallback(t,e),this},setBreadcrumbCallback:function(e){var t=this._globalOptions.breadcrumbCallback;return this._globalOptions.breadcrumbCallback=keepOriginalCallback(t,e),this},setShouldSendCallback:function(e){var t=this._globalOptions.shouldSendCallback;return this._globalOptions.shouldSendCallback=keepOriginalCallback(t,e),this},setTransport:function(e){return this._globalOptions.transport=e,this},lastException:function(){return this._lastCapturedException},lastEventId:function(){return this._lastEventId},isSetup:function(){return!!this._hasJSON&&(!!this._globalServer||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this._logDebug("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var e=_window$1.RavenConfig;e&&this.config(e.dsn,e.config).install()},showReportDialog:function(e){if(_document){var t=(e=e||{}).eventId||this.lastEventId();if(!t)throw new configError("Missing eventId");var n=e.dsn||this._dsn;if(!n)throw new configError("Missing DSN");var r=encodeURIComponent,o="";o+="?eventId="+r(t),o+="&dsn="+r(n);var a=e.user||this._globalContext.user;a&&(a.name&&(o+="&name="+r(a.name)),a.email&&(o+="&email="+r(a.email)));var i=this._getGlobalServer(this._parseDSN(n)),s=_document.createElement("script");s.async=!0,s.src=i+"/api/embed/error-page/"+o,(_document.head||_document.body).appendChild(s)}},_ignoreNextOnError:function(){var e=this;this._ignoreOnError+=1,setTimeout(function(){e._ignoreOnError-=1})},_triggerEvent:function(e,t){var n,r;if(this._hasDocument){t=t||{},e="raven"+e.substr(0,1).toUpperCase()+e.substr(1),_document.createEvent?(n=_document.createEvent("HTMLEvents")).initEvent(e,!0,!0):(n=_document.createEventObject()).eventType=e;for(r in t)hasKey(t,r)&&(n[r]=t[r]);if(_document.createEvent)_document.dispatchEvent(n);else try{_document.fireEvent("on"+n.eventType.toLowerCase(),n)}catch(e){}}},_breadcrumbEventHandler:function(e){var t=this;return function(n){if(t._keypressTimeout=null,t._lastCapturedEvent!==n){t._lastCapturedEvent=n;var r;try{r=htmlTreeAsString(n.target)}catch(e){r=""}t.captureBreadcrumb({category:"ui."+e,message:r})}}},_keypressEventHandler:function(){var e=this;return function(t){var n;try{n=t.target}catch(e){return}var r=n&&n.tagName;if(r&&("INPUT"===r||"TEXTAREA"===r||n.isContentEditable)){var o=e._keypressTimeout;o||e._breadcrumbEventHandler("input")(t),clearTimeout(o),e._keypressTimeout=setTimeout(function(){e._keypressTimeout=null},1e3)}}},_captureUrlChange:function(e,t){var n=parseUrl(this._location.href),r=parseUrl(t),o=parseUrl(e);this._lastHref=t,n.protocol===r.protocol&&n.host===r.host&&(t=r.relative),n.protocol===o.protocol&&n.host===o.host&&(e=o.relative),this.captureBreadcrumb({category:"navigation",data:{to:t,from:e}})},_instrumentTryCatch:function(){function e(e){return function(n,r){for(var o=new Array(arguments.length),a=0;a2?arguments[2]:void 0;return n&&t._captureUrlChange(t._lastHref,n+""),e.apply(this,arguments)}},r)}if(n.console&&"console"in _window$1&&console.log){var l=function(e,n){t.captureBreadcrumb({message:e,level:n.level,category:"console"})};each(["debug","info","warn","error","log"],function(e,t){wrapConsoleMethod(console,t,l)})}},_restoreBuiltIns:function(){for(var e;this._wrappedBuiltIns.length;){var t=(e=this._wrappedBuiltIns.shift())[0],n=e[1],r=e[2];t[n]=r}},_drainPlugins:function(){var e=this;each(this._plugins,function(t,n){var r=n[0],o=n[1];r.apply(e,[e].concat(o))})},_parseDSN:function(e){var t=dsnPattern.exec(e),n={},r=7;try{for(;r--;)n[dsnKeys[r]]=t[r]||""}catch(t){throw new configError("Invalid DSN: "+e)}if(n.pass&&!this._globalOptions.allowSecretKey)throw new configError("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return n},_getGlobalServer:function(e){var t="//"+e.host+(e.port?":"+e.port:"");return e.protocol&&(t=e.protocol+":"+t),t},_handleOnErrorStackInfo:function(){this._ignoreOnError||this._handleStackInfo.apply(this,arguments)},_handleStackInfo:function(e,t){var n=this._prepareFrames(e,t);this._triggerEvent("handle",{stackInfo:e,options:t}),this._processException(e.name,e.message,e.url,e.lineno,n,t)},_prepareFrames:function(e,t){var n=this,r=[];if(e.stack&&e.stack.length&&(each(e.stack,function(t,o){var a=n._normalizeFrame(o,e.url);a&&r.push(a)}),t&&t.trimHeadFrames))for(var o=0;o0&&(e.breadcrumbs={values:[].slice.call(this._breadcrumbs,0)}),isEmptyObject(e.tags)&&delete e.tags,this._globalContext.user&&(e.user=this._globalContext.user),t.environment&&(e.environment=t.environment),t.release&&(e.release=t.release),t.serverName&&(e.server_name=t.serverName),isFunction(t.dataCallback)&&(e=t.dataCallback(e)||e),e&&!isEmptyObject(e)&&(isFunction(t.shouldSendCallback)&&!t.shouldSendCallback(e)||(this._shouldBackoff()?this._logDebug("warn","Raven dropped error due to backoff: ",e):"number"==typeof t.sampleRate?Math.random() ".length;e&&r++<5&&!("html"===(t=htmlElementAsString(e))||r>1&&o+n.length*a+t.length>=80);)n.push(t),o+=t.length,e=e.parentNode;return n.reverse().join(" > ")}function htmlElementAsString(e){var t,n,r,o,a,i=[];if(!e||!e.tagName)return"";if(i.push(e.tagName.toLowerCase()),e.id&&i.push("#"+e.id),(t=e.className)&&isString(t))for(n=t.split(/\s+/),a=0;a":"anonymous component")+(e._isVue&&e.$options.__file?" at "+e.$options.__file:"")}function vuePlugin(e,t){if((t=t||window.Vue)&&t.config){var n=t.config.errorHandler;t.config.errorHandler=function(t,r,o){var a={componentName:formatComponentName(r),propsData:r.$options.propsData};void 0!==o&&(a.lifecycleHook=o),e.captureException(t,{extra:a}),"function"==typeof n&&n.call(this,t,r,o)}}}function VueSentry(e,t){var n={enable:!0};t&&(t=_extends({},n,t)),t.enable&&(singleton.config((t.protocol||"https")+"://"+t.key+"@"+(t.server||"sentry.io")+"/"+t.project,_extends({},t.config)).addPlugin(vue,e).install(),e.prototype.$raven=singleton)}var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},utils={isObject:isObject$1,isError:isError$1,wrappedCallback:wrappedCallback},TraceKit={collectWindowErrors:!0,debug:!1},_window$2="undefined"!=typeof window?window:void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{},_slice=[].slice,UNKNOWN_FUNCTION="?",ERROR_TYPES_RE=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;TraceKit.report=function(){function e(e,t){var n=null;if(!t||TraceKit.collectWindowErrors){for(var r in l)if(l.hasOwnProperty(r))try{l[r].apply(null,[e].concat(_slice.call(arguments,2)))}catch(e){n=e}if(n)throw n}}function t(t,n,r,a,s){if(f)TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(f,n,r,t),o();else if(s&&utils.isError(s))e(TraceKit.computeStackTrace(s),!0);else{var l,c={url:n,line:r,column:a},u=void 0,h=t;"[object String]"==={}.toString.call(t)&&(l=t.match(ERROR_TYPES_RE))&&(u=l[1],h=l[2]),c.func=UNKNOWN_FUNCTION,e({name:u,message:h,url:getLocationHref(),stack:[c]},!0)}return!!i&&i.apply(this,arguments)}function n(){s||(i=_window$2.onerror,_window$2.onerror=t,s=!0)}function r(){s&&(_window$2.onerror=i,s=!1,i=void 0)}function o(){var t=f,n=c;c=null,f=null,u=null,e.apply(null,[t,!1].concat(n))}function a(e,t){var n=_slice.call(arguments,1);if(f){if(u===e)return;o()}var r=TraceKit.computeStackTrace(e);if(f=r,u=e,c=n,setTimeout(function(){u===e&&o()},r.incomplete?2e3:0),!1!==t)throw e}var i,s,l=[],c=null,u=null,f=null;return a.subscribe=function(e){n(),l.push(e)},a.unsubscribe=function(e){for(var t=l.length-1;t>=0;--t)l[t]===e&&l.splice(t,1)},a.uninstall=function(){r(),l=[]},a}(),TraceKit.computeStackTrace=function(){function e(e){if(void 0!==e.stack&&e.stack){for(var t,n,r,o=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,i=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,s=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,l=/\((\S*)(?::(\d+))(?::(\d+))\)/,c=e.stack.split("\n"),u=[],f=(/^(.*) is undefined$/.exec(e.message),0),h=c.length;f eval")>-1;d&&(t=s.exec(n[3]))?(n[3]=t[1],n[4]=t[2],n[5]=null):0!==f||n[5]||void 0===e.columnNumber||(u[0].column=e.columnNumber+1),r={url:n[3],func:n[1]||UNKNOWN_FUNCTION,args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}!r.func&&r.line&&(r.func=UNKNOWN_FUNCTION),u.push(r)}return u.length?{name:e.name,message:e.message,url:getLocationHref(),stack:u}:null}}function t(e,t,n,r){var o={url:t,line:n};if(o.url&&o.line){if(e.incomplete=!1,o.func||(o.func=UNKNOWN_FUNCTION),e.stack.length>0&&e.stack[0].url===o.url){if(e.stack[0].line===o.line)return!1;if(!e.stack[0].line&&e.stack[0].func===o.func)return e.stack[0].line=o.line,!1}return e.stack.unshift(o),e.partial=!0,!0}return e.incomplete=!0,!1}function n(e,o){for(var a,i,s=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,l=[],c={},u=!1,f=n.caller;f&&!u;f=f.caller)if(f!==r&&f!==TraceKit.report){if(i={url:null,func:UNKNOWN_FUNCTION,line:null,column:null},f.name?i.func=f.name:(a=s.exec(f.toString()))&&(i.func=a[1]),void 0===i.func)try{i.func=a.input.substring(0,a.input.indexOf("{"))}catch(e){}c[""+f]?u=!0:c[""+f]=!0,l.push(i)}o&&l.splice(0,o);var h={name:e.name,message:e.message,url:getLocationHref(),stack:l};return t(h,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),h}function r(t,r){var o=null;r=null==r?0:+r;try{if(o=e(t))return o}catch(e){if(TraceKit.debug)throw e}try{if(o=n(t,r+1))return o}catch(e){if(TraceKit.debug)throw e}return{name:t.name,message:t.message,url:getLocationHref()}}return r.augmentStackTraceWithInitialElement=t,r.computeStackTraceFromStackProp=e,r}();var tracekit=TraceKit,stringify_1=createCommonjsModule(function(e,t){function n(e,t){for(var n=0;n0){var l=n(o,this);~l?o.splice(l+1):o.push(this),~l?a.splice(l,1/0,i):a.push(i),~n(o,s)&&(s=t.call(this,i,s))}else o.push(s);return null==e?s instanceof Error?r(s):s:e.call(this,i,s)}}(e.exports=function(e,t,n,r){return JSON.stringify(e,o(t,r),n)}).getSerialize=o});RavenConfigError.prototype=new Error,RavenConfigError.prototype.constructor=RavenConfigError;var configError=RavenConfigError,wrapMethod=function(e,t,n){var r=e[t],o=e;if(t in e){var a="warn"===t?"warning":t;e[t]=function(){var e=[].slice.call(arguments),i=""+e.join(" "),s={level:a,logger:"console",extra:{arguments:e}};"assert"===t?!1===e[0]&&(i="Assertion failed: "+(e.slice(1).join(" ")||"console.assert"),s.extra.arguments=e.slice(1),n&&n(i,s)):n&&n(i,s),r&&Function.prototype.apply.call(r,o,e)}}},console$1={wrapMethod:wrapMethod},isError=utils.isError,isObject=utils.isObject,wrapConsoleMethod=console$1.wrapMethod,dsnKeys="source protocol user pass host port path".split(" "),dsnPattern=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/,_window$1="undefined"!=typeof window?window:void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{},_document=_window$1.document,_navigator=_window$1.navigator;Raven$2.prototype={VERSION:"3.18.1",debug:!1,TraceKit:tracekit,config:function(e,t){var n=this;if(n._globalServer)return this._logDebug("error","Error: Raven has already been configured"),n;if(!e)return n;var r=n._globalOptions;t&&each(t,function(e,t){"tags"===e||"extra"===e||"user"===e?n._globalContext[e]=t:r[e]=t}),n.setDSN(e),r.ignoreErrors.push(/^Script error\.?$/),r.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),r.ignoreErrors=joinRegExp(r.ignoreErrors),r.ignoreUrls=!!r.ignoreUrls.length&&joinRegExp(r.ignoreUrls),r.whitelistUrls=!!r.whitelistUrls.length&&joinRegExp(r.whitelistUrls),r.includePaths=joinRegExp(r.includePaths),r.maxBreadcrumbs=Math.max(0,Math.min(r.maxBreadcrumbs||100,100));var o={xhr:!0,console:!0,dom:!0,location:!0},a=r.autoBreadcrumbs;"[object Object]"==={}.toString.call(a)?a=objectMerge(o,a):!1!==a&&(a=o),r.autoBreadcrumbs=a;var i={tryCatch:!0},s=r.instrument;return"[object Object]"==={}.toString.call(s)?s=objectMerge(i,s):!1!==s&&(s=i),r.instrument=s,tracekit.collectWindowErrors=!!r.collectWindowErrors,n},install:function(){var e=this;return e.isSetup()&&!e._isRavenInstalled&&(tracekit.report.subscribe(function(){e._handleOnErrorStackInfo.apply(e,arguments)}),e._globalOptions.instrument&&e._globalOptions.instrument.tryCatch&&e._instrumentTryCatch(),e._globalOptions.autoBreadcrumbs&&e._instrumentBreadcrumbs(),e._drainPlugins(),e._isRavenInstalled=!0),Error.stackTraceLimit=e._globalOptions.stackTraceLimit,this},setDSN:function(e){var t=this,n=t._parseDSN(e),r=n.path.lastIndexOf("/"),o=n.path.substr(1,r);t._dsn=e,t._globalKey=n.user,t._globalSecret=n.pass&&n.pass.substr(1),t._globalProject=n.path.substr(r+1),t._globalServer=t._getGlobalServer(n),t._globalEndpoint=t._globalServer+"/"+o+"api/"+t._globalProject+"/store/",this._resetBackoff()},context:function(e,t,n){return isFunction(e)&&(n=t||[],t=e,e=void 0),this.wrap(e,t).apply(this,n)},wrap:function(e,t,n){function r(){var r=[],a=arguments.length,i=!e||e&&!1!==e.deep;for(n&&isFunction(n)&&n.apply(this,arguments);a--;)r[a]=i?o.wrap(e,arguments[a]):arguments[a];try{return t.apply(this,r)}catch(t){throw o._ignoreNextOnError(),o.captureException(t,e),t}}var o=this;if(isUndefined(t)&&!isFunction(e))return e;if(isFunction(e)&&(t=e,e=void 0),!isFunction(t))return t;try{if(t.__raven__)return t;if(t.__raven_wrapper__)return t.__raven_wrapper__}catch(e){return t}for(var a in t)hasKey(t,a)&&(r[a]=t[a]);return r.prototype=t.prototype,t.__raven_wrapper__=r,r.__raven__=!0,r.__inner__=t,r},uninstall:function(){return tracekit.report.uninstall(),this._restoreBuiltIns(),Error.stackTraceLimit=this._originalErrorStackTraceLimit,this._isRavenInstalled=!1,this},captureException:function(e,t){if(!isError(e))return this.captureMessage(e,objectMerge({trimHeadFrames:1,stacktrace:!0},t));this._lastCapturedException=e;try{var n=tracekit.computeStackTrace(e);this._handleStackInfo(n,t)}catch(t){if(e!==t)throw t}return this},captureMessage:function(e,t){if(!this._globalOptions.ignoreErrors.test||!this._globalOptions.ignoreErrors.test(e)){var n=objectMerge({message:e+""},t=t||{});if(this._globalOptions.stacktrace||t&&t.stacktrace){var r;try{throw new Error(e)}catch(e){r=e}r.name=null,t=objectMerge({fingerprint:e,trimHeadFrames:(t.trimHeadFrames||0)+1},t);var o=tracekit.computeStackTrace(r),a=this._prepareFrames(o,t);n.stacktrace={frames:a.reverse()}}return this._send(n),this}},captureBreadcrumb:function(e){var t=objectMerge({timestamp:now()/1e3},e);if(isFunction(this._globalOptions.breadcrumbCallback)){var n=this._globalOptions.breadcrumbCallback(t);if(isObject(n)&&!isEmptyObject(n))t=n;else if(!1===n)return this}return this._breadcrumbs.push(t),this._breadcrumbs.length>this._globalOptions.maxBreadcrumbs&&this._breadcrumbs.shift(),this},addPlugin:function(e){var t=[].slice.call(arguments,1);return this._plugins.push([e,t]),this._isRavenInstalled&&this._drainPlugins(),this},setUserContext:function(e){return this._globalContext.user=e,this},setExtraContext:function(e){return this._mergeContext("extra",e),this},setTagsContext:function(e){return this._mergeContext("tags",e),this},clearContext:function(){return this._globalContext={},this},getContext:function(){return JSON.parse(stringify_1(this._globalContext))},setEnvironment:function(e){return this._globalOptions.environment=e,this},setRelease:function(e){return this._globalOptions.release=e,this},setDataCallback:function(e){var t=this._globalOptions.dataCallback;return this._globalOptions.dataCallback=keepOriginalCallback(t,e),this},setBreadcrumbCallback:function(e){var t=this._globalOptions.breadcrumbCallback;return this._globalOptions.breadcrumbCallback=keepOriginalCallback(t,e),this},setShouldSendCallback:function(e){var t=this._globalOptions.shouldSendCallback;return this._globalOptions.shouldSendCallback=keepOriginalCallback(t,e),this},setTransport:function(e){return this._globalOptions.transport=e,this},lastException:function(){return this._lastCapturedException},lastEventId:function(){return this._lastEventId},isSetup:function(){return!!this._hasJSON&&(!!this._globalServer||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this._logDebug("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var e=_window$1.RavenConfig;e&&this.config(e.dsn,e.config).install()},showReportDialog:function(e){if(_document){var t=(e=e||{}).eventId||this.lastEventId();if(!t)throw new configError("Missing eventId");var n=e.dsn||this._dsn;if(!n)throw new configError("Missing DSN");var r=encodeURIComponent,o="";o+="?eventId="+r(t),o+="&dsn="+r(n);var a=e.user||this._globalContext.user;a&&(a.name&&(o+="&name="+r(a.name)),a.email&&(o+="&email="+r(a.email)));var i=this._getGlobalServer(this._parseDSN(n)),s=_document.createElement("script");s.async=!0,s.src=i+"/api/embed/error-page/"+o,(_document.head||_document.body).appendChild(s)}},_ignoreNextOnError:function(){var e=this;this._ignoreOnError+=1,setTimeout(function(){e._ignoreOnError-=1})},_triggerEvent:function(e,t){var n,r;if(this._hasDocument){t=t||{},e="raven"+e.substr(0,1).toUpperCase()+e.substr(1),_document.createEvent?(n=_document.createEvent("HTMLEvents")).initEvent(e,!0,!0):(n=_document.createEventObject()).eventType=e;for(r in t)hasKey(t,r)&&(n[r]=t[r]);if(_document.createEvent)_document.dispatchEvent(n);else try{_document.fireEvent("on"+n.eventType.toLowerCase(),n)}catch(e){}}},_breadcrumbEventHandler:function(e){var t=this;return function(n){if(t._keypressTimeout=null,t._lastCapturedEvent!==n){t._lastCapturedEvent=n;var r;try{r=htmlTreeAsString(n.target)}catch(e){r=""}t.captureBreadcrumb({category:"ui."+e,message:r})}}},_keypressEventHandler:function(){var e=this;return function(t){var n;try{n=t.target}catch(e){return}var r=n&&n.tagName;if(r&&("INPUT"===r||"TEXTAREA"===r||n.isContentEditable)){var o=e._keypressTimeout;o||e._breadcrumbEventHandler("input")(t),clearTimeout(o),e._keypressTimeout=setTimeout(function(){e._keypressTimeout=null},1e3)}}},_captureUrlChange:function(e,t){var n=parseUrl(this._location.href),r=parseUrl(t),o=parseUrl(e);this._lastHref=t,n.protocol===r.protocol&&n.host===r.host&&(t=r.relative),n.protocol===o.protocol&&n.host===o.host&&(e=o.relative),this.captureBreadcrumb({category:"navigation",data:{to:t,from:e}})},_instrumentTryCatch:function(){function e(e){return function(n,r){for(var o=new Array(arguments.length),a=0;a2?arguments[2]:void 0;return n&&t._captureUrlChange(t._lastHref,n+""),e.apply(this,arguments)}},r)}if(n.console&&"console"in _window$1&&console.log){var l=function(e,n){t.captureBreadcrumb({message:e,level:n.level,category:"console"})};each(["debug","info","warn","error","log"],function(e,t){wrapConsoleMethod(console,t,l)})}},_restoreBuiltIns:function(){for(var e;this._wrappedBuiltIns.length;){var t=(e=this._wrappedBuiltIns.shift())[0],n=e[1],r=e[2];t[n]=r}},_drainPlugins:function(){var e=this;each(this._plugins,function(t,n){var r=n[0],o=n[1];r.apply(e,[e].concat(o))})},_parseDSN:function(e){var t=dsnPattern.exec(e),n={},r=7;try{for(;r--;)n[dsnKeys[r]]=t[r]||""}catch(t){throw new configError("Invalid DSN: "+e)}if(n.pass&&!this._globalOptions.allowSecretKey)throw new configError("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return n},_getGlobalServer:function(e){var t="//"+e.host+(e.port?":"+e.port:"");return e.protocol&&(t=e.protocol+":"+t),t},_handleOnErrorStackInfo:function(){this._ignoreOnError||this._handleStackInfo.apply(this,arguments)},_handleStackInfo:function(e,t){var n=this._prepareFrames(e,t);this._triggerEvent("handle",{stackInfo:e,options:t}),this._processException(e.name,e.message,e.url,e.lineno,n,t)},_prepareFrames:function(e,t){var n=this,r=[];if(e.stack&&e.stack.length&&(each(e.stack,function(t,o){var a=n._normalizeFrame(o,e.url);a&&r.push(a)}),t&&t.trimHeadFrames))for(var o=0;o0&&(e.breadcrumbs={values:[].slice.call(this._breadcrumbs,0)}),isEmptyObject(e.tags)&&delete e.tags,this._globalContext.user&&(e.user=this._globalContext.user),t.environment&&(e.environment=t.environment),t.release&&(e.release=t.release),t.serverName&&(e.server_name=t.serverName),isFunction(t.dataCallback)&&(e=t.dataCallback(e)||e),e&&!isEmptyObject(e)&&(isFunction(t.shouldSendCallback)&&!t.shouldSendCallback(e)||(this._shouldBackoff()?this._logDebug("warn","Raven dropped error due to backoff: ",e):"number"==typeof t.sampleRate?Math.random()", 22 | "license": "MIT", 23 | "bugs": { 24 | "url": "https://github.com/ktquez/vue2-sentry/issues" 25 | }, 26 | "homepage": "https://github.com/ktquez/vue2-sentry#readme", 27 | "devDependencies": { 28 | "babel-core": "^6.26.0", 29 | "babel-preset-env": "^1.6.0", 30 | "babel-preset-stage-2": "^6.24.1", 31 | "cross-env": "^5.1.0", 32 | "rollup": "^0.50.0", 33 | "rollup-plugin-alias": "^1.3.1", 34 | "rollup-plugin-babel": "^3.0.2", 35 | "rollup-plugin-commonjs": "^8.2.1", 36 | "rollup-plugin-node-resolve": "^3.0.0", 37 | "rollup-plugin-replace": "^2.0.0", 38 | "rollup-plugin-uglify": "^2.0.1", 39 | "rollup-plugin-vue": "^2.5.2", 40 | "rollup-plugin-vue2": "^0.8.0", 41 | "uglify-es": "^3.1.3" 42 | }, 43 | "dependencies": { 44 | "raven-js": "^3.18.1", 45 | "vue": "^2.5.2" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import commonjs from 'rollup-plugin-commonjs' 2 | import uglify from 'rollup-plugin-uglify' 3 | import { minify } from 'uglify-es' 4 | import resolve from 'rollup-plugin-node-resolve' 5 | import replace from 'rollup-plugin-replace' 6 | import babel from 'rollup-plugin-babel' 7 | import VueLoader from 'rollup-plugin-vue' 8 | 9 | export default { 10 | entry: 'src/index.js', 11 | plugins: [ 12 | resolve(), 13 | VueLoader(), 14 | commonjs(), 15 | uglify({}, minify), 16 | babel({ 17 | exclude: 'node_modules/**' 18 | }), 19 | replace({ 20 | 'process.env.NODE_ENV': JSON.stringify('production') 21 | }) 22 | ], 23 | targets: [ 24 | { 25 | dest: 'dist/vue2-sentry.cjs.js', 26 | format: 'cjs' 27 | }, 28 | { 29 | dest: 'dist/vue2-sentry.es.js', 30 | format: 'es' 31 | }, 32 | { 33 | dest: 'dist/vue2-sentry.amd.js', 34 | format: 'amd' 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import Raven from 'raven-js' 2 | import RavenVue from 'raven-js/plugins/vue' 3 | 4 | export default function VueSentry (Vue, options) { 5 | 6 | const _options = { 7 | enable: true 8 | } 9 | 10 | if (options) { 11 | options = {..._options, ...options} 12 | } 13 | 14 | if (!options.enable) return 15 | 16 | Raven 17 | .config(`${options.protocol || 'https'}://${options.key}@${options.server || 'sentry.io'}/${options.project}`, { 18 | ...options.config 19 | }) 20 | .addPlugin(RavenVue, Vue) 21 | .install() 22 | 23 | Vue.prototype.$raven = Raven 24 | } 25 | --------------------------------------------------------------------------------