This plugin uses sentry-android and sentry-cocoa to catch native errors/stack traces and send them to a sentry server.
NOTE: If you have a native exeption and the app exits the plugin will save the log and send it in the next app startup, this is how the native plugins are implemented and it is expected behavior
tns plugin add nativescript-sentry.io
import { Sentry } from 'nativescript-sentry.io';
const dsn = 'https://<key>:<secret>@host/<project>';
Sentry.init(dsn);
import { SentryModule } from 'nativescript-sentry.io/angular';
NgModule({
...
imports: [
SentryModule.forRoot({dsn: 'https://<key>:<secret>@host/<project>'})
],
Note: this plugin adds a custom ErrorHandler and automatically provides it
Sentry.init(dsn: string, options: SentryOptions)
Sentry.captureException(exeption: Error, options: SentryOptions)
Example:
try {
throw 'try catch Exception example'
} catch(error) {
Sentry.captureException(error, {});
}
Sentry.captureMessage(message: string, options: SentryOptions)
Sentry.captureBreadcrumb(breadcrumb:SentryBreadcrumb)
Sentry.setContextUser(user: SentryUser)
Sentry.setContextTags(tags: any)
Sentry.setContextExtra(extra: any)
`Sentry.clearContext()``