sentry-adonis-v6
Version:
Sentry provider for adonisjs v6 framework
22 lines (21 loc) • 752 B
JavaScript
import { RuntimeException } from '@poppinss/utils';
import { SentryManager } from '../src/sentry_manager.js';
export default class SentryProvider {
app;
constructor(app) {
this.app = app;
}
async register() {
this.app.container.singleton('sentry', async (resolver) => {
const configService = await resolver.make('config');
const config = configService.get('sentry');
if (!config) {
throw new RuntimeException('Invalid config exported from "config/sentry.ts" file. Make sure to use the defineConfig method');
}
return SentryManager.init({
...config,
});
});
this.app.container.make('sentry');
}
}