Sentry
This service provides an instantiated Sentry client for interacting with the Sentry platform.
Initialization
The Sentry client is initialized automatically when @rhapsody/sentry is imported.
Interacting with the Sentry Client
We can import Sentry functions from @rhapsody/sentry like we would any package. The client has full access to all functions that @sentry/react has access to, but they will need to be exported in sentry/src/index.ts
import { captureException } from '@rhapsody/sentry'
captureException(error)
If you need to include additional information with the notification, a context object can be provided as the second argument to captureException. This object is called a Context and can be used to pass tags which are searchable in the Sentry dasshboard, and should be short key value pairs, or extras which is non-searchable metadata.
import { captureException } from '@rhapsody/sentry'
captureException(error, {
tags: {
name: 'Enter Name Here',
},
})
captureException(error, {
extra: {
message: 'Longer error message',
customMetadata: 'She sells sea shells by the seashore',
},
})