Skip to content

Commit

Permalink
feat: Support nuxt 1.0 new hook system
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkside73 committed Jan 15, 2018
1 parent 80be8a7 commit 85bf6d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/sentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ module.exports = function sentry (moduleOptions) {
})
}

// Hook in to Nuxt renderer
this.nuxt.plugin('renderer', (renderer) => {
const hook = (renderer) => {
renderer.app.use(Raven.requestHandler())

// Grab Nuxt's original error middleware and overwrite it with our own
Expand All @@ -55,5 +54,8 @@ module.exports = function sentry (moduleOptions) {
// Call Nuxt's original error middleware
nuxtErrorMiddleware.call(renderer, err, req, res, next)
}
})
}

// Hook in to Nuxt renderer
this.nuxt.hook ? this.nuxt.hook('render:before', hook) : this.nuxt.plugin('renderer', hook)
}

0 comments on commit 85bf6d0

Please sign in to comment.