API Reference

Types

TypeScript type definitions and interfaces exported by @eienjs/adonisjs-sentry.

Import type definitions directly from @eienjs/adonisjs-sentry/types:

import type {
  ExceptionConstructor,
  SentryConfig,
  SentryReportOptions,
} from '@eienjs/adonisjs-sentry/types';

SentryConfig

The main configuration interface passed to defineConfig. It extends Sentry's native NodeOptions from @sentry/node (excluding dsn and environment which have specialized definitions here).

export interface SentryConfig extends Omit<NodeOptions, 'dsn' | 'environment'> {
  /**
   * Enable or disable Sentry
   */
  enabled: boolean;

  /**
   * The environment Sentry is running in
   */
  environment: string;

  /**
   * The DSN of the project. Optional so the app can run without it
   * when Sentry is disabled.
   */
  dsn?: string;

  /**
   * Options controlling how exceptions are reported
   */
  report?: SentryReportOptions;
}

SentryReportOptions

Options controlling error filtering, context extraction, and issue fingerprinting in reportException.

export interface SentryReportOptions {
  /**
   * HTTP statuses that should never be reported.
   */
  ignoreStatuses?: number[];

  /**
   * Error codes (e.g. "E_VALIDATION_ERROR") that should never be reported.
   */
  ignoreCodes?: string[];

  /**
   * Exception classes that should never be reported.
   */
  ignoreExceptions?: ExceptionConstructor[];

  /**
   * Attach the authenticated user (ctx.auth.user) to the event.
   * Defaults to true. Email and IP are only sent when dataCollection.userInfo is not false.
   */
  captureUser?: boolean;

  /**
   * Group events by the Adonis error code (E_*) instead of the message.
   * Defaults to true.
   */
  fingerprintByCode?: boolean;
}

ExceptionConstructor

A constructor type matching abstract or concrete exception classes for instanceof checks in ignoreExceptions:

export type ExceptionConstructor = abstract new (...args: any[]) => unknown;