JulianMar / nuxt-bugsnag

Bugsnag module for nuxt.js
MIT License
49 stars 18 forks source link

Log custom errors #12

Closed simplenotezy closed 4 years ago

simplenotezy commented 4 years ago

How can I log custom errors? E.g. send an event to the log when a user hits a 500 or 404 page.

JulianMar commented 4 years ago

The simplest answer is like this.

this.$bugsnag.notify(new Error('Some Error'))

This answer holds up for components and store. There are some places where it doesn't work like that, because this is not binded to the app. In Nuxt if you don't have this you will have context and there is $bugsnag under app so in code form:

plugins/exampleLog.js

export default (context) => {
  context.app.$bugsnag.notify(new Error('some Error')
}

If you need more help just hit me up :)

simplenotezy commented 4 years ago

Super awesome. Would be great to have documentet