Class: Aws::Xray::ErrorHandlerWithSentry
- Inherits:
-
Object
- Object
- Aws::Xray::ErrorHandlerWithSentry
- Defined in:
- lib/aws/xray/error_handlers.rb
Overview
Must be configured sentry-raven or sentry-ruby gem.
Defined Under Namespace
Classes: MissingSentryError
Constant Summary collapse
- ERROR_LEVEL =
'warning'.freeze
Instance Method Summary collapse
- #call(error, payload, host:, port:) ⇒ Object
-
#initialize ⇒ ErrorHandlerWithSentry
constructor
A new instance of ErrorHandlerWithSentry.
Constructor Details
#initialize ⇒ ErrorHandlerWithSentry
Returns a new instance of ErrorHandlerWithSentry.
28 29 30 31 32 |
# File 'lib/aws/xray/error_handlers.rb', line 28 def initialize if !defined?(::Sentry) && !defined?(::Raven) raise MissingSentryError.new('Must be installed sentry-raven or sentry-ruby gem') end end |
Instance Method Details
#call(error, payload, host:, port:) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/aws/xray/error_handlers.rb', line 36 def call(error, payload, host:, port:) if defined?(::Raven) ::Raven.capture_exception( error, level: ERROR_LEVEL, extra: { 'payload' => payload, 'payload_raw' => payload.unpack('H*').first } ) return end ::Sentry.capture_exception( error, level: ERROR_LEVEL, extra: { 'payload' => payload, 'payload_raw' => payload.unpack('H*').first } ) end |