gl_exception_notifier 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gl_exception_notifier.rb +26 -26
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b68519f4f914744ec632025065b9c6c26a94afa25b95de8fcf71bf552386c616
|
4
|
+
data.tar.gz: 2d62a3d4e4a9ab99eca8d3392e55f9e18cd54d611cbd22785dfda6fcc25b186e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a5eb431ec707408108319d9354a888d0cb889371e3f1d65fe56d97f6e6bda611dddbad6490f132c6a30ffbc7e615002ab0bf7196a1414936c6dd5c7583be17
|
7
|
+
data.tar.gz: 5b18ba1c14e4ea566d04b4aa6ce2fcbe95406736d8c15d83e8cfa5ea5252d9f46c7edaefad48c1c7bc290488a0e0d5045d951ac6299c0d31f7521939a8c5f6ec
|
@@ -12,32 +12,6 @@ class GLExceptionNotifier
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def capture_exception(args)
|
16
|
-
error_client.capture_exception(*args)
|
17
|
-
end
|
18
|
-
|
19
|
-
def capture_message(args)
|
20
|
-
if args.first.is_a?(String)
|
21
|
-
message = args.first
|
22
|
-
extra = args.length == 2 && args.last.is_a?(Hash) ? args.last : { parameters: args.drop(1) }
|
23
|
-
else
|
24
|
-
message_info = if args.first.is_a?(Hash)
|
25
|
-
'called with kwargs, should have been positional'
|
26
|
-
else
|
27
|
-
'Unknown parameter set'
|
28
|
-
end
|
29
|
-
message = "GLExceptionNotifier: #{message_info}"
|
30
|
-
extra = { parameters: args }
|
31
|
-
end
|
32
|
-
|
33
|
-
error_client.capture_message(message, extra:)
|
34
|
-
end
|
35
|
-
|
36
|
-
def exceptionable?(obj)
|
37
|
-
obj.is_a?(Exception) ||
|
38
|
-
(obj.respond_to?(:ancestors) && obj.ancestors.include?(Exception))
|
39
|
-
end
|
40
|
-
|
41
15
|
# @parmas type [Symbol] the type of context to add, either `:tags_context`, `:user_context`, or `:extra_context`
|
42
16
|
# @params context [Hash] the key values to add as context
|
43
17
|
def add_context(type, context)
|
@@ -74,6 +48,32 @@ class GLExceptionNotifier
|
|
74
48
|
|
75
49
|
private
|
76
50
|
|
51
|
+
def exceptionable?(obj)
|
52
|
+
obj.is_a?(Exception) ||
|
53
|
+
(obj.respond_to?(:ancestors) && obj.ancestors.include?(Exception))
|
54
|
+
end
|
55
|
+
|
56
|
+
def capture_exception(args)
|
57
|
+
error_client.capture_exception(*args)
|
58
|
+
end
|
59
|
+
|
60
|
+
def capture_message(args)
|
61
|
+
if args.first.is_a?(String)
|
62
|
+
message = args.first
|
63
|
+
extra = args.length == 2 && args.last.is_a?(Hash) ? args.last : { parameters: args.drop(1) }
|
64
|
+
else
|
65
|
+
message_info = if args.first.is_a?(Hash)
|
66
|
+
'called with kwargs, should have been positional'
|
67
|
+
else
|
68
|
+
'Unknown parameter set'
|
69
|
+
end
|
70
|
+
message = "GLExceptionNotifier: #{message_info}"
|
71
|
+
extra = { parameters: args }
|
72
|
+
end
|
73
|
+
|
74
|
+
error_client.capture_message(message, extra:)
|
75
|
+
end
|
76
|
+
|
77
77
|
def error_client
|
78
78
|
Sentry
|
79
79
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gl_exception_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Give Lively
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-
|
14
|
+
date: 2024-07-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: sentry-rails
|