Skip to content

Commit c92dac2

Browse files
committed
sentry report error ivars
1 parent cdb0321 commit c92dac2

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

lib/coaster/core_ext/standard_error.rb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,8 @@ def inspection_value_proc
252252
attributes[:inspection_value_proc] || self.class.inspection_value_proc
253253
end
254254

255-
def to_inspection_hash(options: {}, _h: {}.with_indifferent_access, _depth: 0)
256-
backtrace_key = options[:backtrace_key] || :backtrace
257-
_h.merge!(
258-
type: self.class.name, status: status,
259-
http_status: http_status, message: message,
260-
instance_variables: {}.with_indifferent_access
261-
)
262-
digest_backtrace # for @digest_backtrace
255+
def to_inspection_ivars
256+
_h = {instance_variables: {}}.with_indifferent_access
263257
instance_variables.sort.each do |var|
264258
if inspection_vars.include?(var)
265259
val = instance_variable_get(var)
@@ -272,6 +266,18 @@ def to_inspection_hash(options: {}, _h: {}.with_indifferent_access, _depth: 0)
272266
_h[:instance_variables][var] = self.class.inspection_value_simple(val)
273267
end
274268
end
269+
_h
270+
end
271+
272+
def to_inspection_hash(options: {}, _h: {}.with_indifferent_access, _depth: 0)
273+
backtrace_key = options[:backtrace_key] || :backtrace
274+
_h.merge!(
275+
type: self.class.name, status: status,
276+
http_status: http_status, message: message,
277+
instance_variables: {}.with_indifferent_access
278+
)
279+
digest_backtrace # for @digest_backtrace
280+
_h.merge!(to_inspection_ivars)
275281
if backtrace.present?
276282
if respond_to?(:cleaned_backtrace)
277283
if (bt = cleaned_backtrace(options))

lib/coaster/core_ext/standard_error/sentry.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def notes(options = {})
2727
nt[:tags][:digest_backtrace] = digest_backtrace if digest_backtrace.present?
2828
nt[:level] ||= self.level
2929
nt[:extra] = attributes.merge(nt[:extra])
30+
nt[:extra][:ivars] = to_inspection_ivars rescue {}
3031
nt[:fingerprint] = sentry_fingerprint
3132
nt
3233
end

lib/coaster/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Coaster
2-
VERSION = '1.4.34'
2+
VERSION = '1.4.35'
33
end

0 commit comments

Comments
 (0)