VueRaven
VueRaven automatically reports uncaught JavaScript exceptions triggered from vue component, and provides a API for reporting your own errors. The captured errors will be reported to the sentry where you can get an overview of your application. If you do not already have a Sentry account, creating your account will be the first step to using this package.
Installation
npm install --save vue-raven# or yarn add vue-raven
Usage
To get started, you need to configure VueRaven to use your Sentry DSN:
Bundler (Webpack, Rollup)
Vue
Browser
<!-- Include after Vue --> <!-- Local files --> <!-- From CDN -->
Only these settings allow VueRaven capture any uncaught exception.
Options
Option | Type | Default | Info |
---|---|---|---|
dsn | String |
null |
The Data Source Name |
public_dsn | String |
null |
If value omitted it will be generated using dsn value, by removing private key part. |
public_key | String |
null |
Will be ignored if dsn provided. |
private_key | String |
null |
Will be ignored if dsn provided. |
host | String |
sentry.io |
Will be ignored if dsn provided. |
protocol | String |
https |
Will be ignored if dsn provided. |
project_Id | String |
null |
Will be ignored if dsn provided. |
path | String |
null |
Will be ignored if dsn provided. |
disableAutoReport | Boolean |
false |
Disable auto report. |
environment | String |
production |
Sentry's environment. |
Reporting Errors
Disable auto report
By default vueraven will report the errors captured automatically, but you can disable using the disableAutoReport
option:
Vue
Report errors manually
In some cases you may want to report erros manually, for this you will have the reven-js api available at the instance of the component.
// my-component methods: // ... async { try await User catch err this$raven }
or
; // my-component methods: // ... async { try await User catch err Raven }
Live demo
We create a small example so you can see the plugin in action.