-
-
Notifications
You must be signed in to change notification settings - Fork 479
/
integrable.rb
36 lines (29 loc) · 1.06 KB
/
integrable.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true
module Sentry
module Integrable
def register_integration(name:, version:)
Sentry.register_integration(name, version)
@integration_name = name
end
def integration_name
@integration_name
end
def capture_exception(exception, **options, &block)
options[:hint] ||= {}
options[:hint][:integration] = integration_name
# within an integration, we usually intercept uncaught exceptions so we set handled to false.
options[:mechanism] ||= Sentry::Mechanism.new(type: integration_name, handled: false)
Sentry.capture_exception(exception, **options, &block)
end
def capture_message(message, **options, &block)
options[:hint] ||= {}
options[:hint][:integration] = integration_name
Sentry.capture_message(message, **options, &block)
end
def capture_check_in(slug, status, **options, &block)
options[:hint] ||= {}
options[:hint][:integration] = integration_name
Sentry.capture_check_in(slug, status, **options, &block)
end
end
end