@yabetoo/adonis5-sentry
TypeScript icon, indicating that this package has built-in type declarations

3.1.1 • Public • Published

Adonis5-Sentry

Sentry, Sentry SDK for Node JS , AdonisJS, Sentry for Adonis

typescript-image npm-image license-image

Sentry service provider for Adonis-5

Table of contents

Installation

npm i --save adonis5-sentry

Compile your code:

node ace serve --watch

Connect all dependences:

node ace invoke adonis5-sentry
  • For other configuration, please update the config/sentry.ts.

Sample Usage

After loading all providers Sentry service will be initialized. After this you can import Sentry service anywhere in your application in such way:

 import Sentry from '@ioc:Adonis/Addons/Sentry'
  • Then you have to send your error details to Sentry. You can use Adonis Exception Handler for this purposes. For example you can implement such Exception Handler:
    import Sentry from '@ioc:Adonis/Addons/Sentry'  
    import Logger from '@ioc:Adonis/Core/Logger'
    import HttpExceptionHandler from '@ioc:Adonis/Core/HttpExceptionHandler'
    
    export default class ExceptionHandler extends HttpExceptionHandler {
      constructor () {
        super(Logger)
      }
    
      public async handle (error, ctx) {
        Sentry.captureException(error)
        return super.handle(error, ctx)
      }
    }

For additional details of Sentry API, please check the Sentry SDK documentation by this link Sentry docs

Readme

Keywords

Package Sidebar

Install

npm i @yabetoo/adonis5-sentry

Weekly Downloads

0

Version

3.1.1

License

MIT

Unpacked Size

9.29 kB

Total Files

10

Last publish

Collaborators

  • yabetoo