Sentry
- 安装 yarn add @sentry/browser @sentry/tracing
- Sentry.init({ dsn: “https://examplePublicKey@o0.ingest.sentry.io/0”, })
- use: Sentry.captureException(err)
Sentry - integrations
Sentry.init({
// ...
integrations: [new MyAwesomeIntegration()],
});
@nuxt/sentry
- yarn add @nuxtjs/sentry
- nuxt.config.js
{ modules: [ '@nuxtjs/sentry' ], sentry: { dsn: '', // Enter your project's DSN here config: {}, // Additional config } }
3.usage ``` Usage in Vue components: this.$sentry.captureException(error)
Usage in asyncData:
async asyncData ({ params, $sentry }) {
try {
let { data } = await axios.get(https://my-api/posts/${params.id}
)
return { title: data.title }
} catch (error) {
$sentry.captureException(error)
}
}
```