Skip to content

Commit 69cf109

Browse files
committed
use exception message instead of original message
which might still contain e.g. encoding errors
1 parent f5fce71 commit 69cf109

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

sentry-ruby/lib/sentry/utils/logging_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ def log_error(message, exception, debug: false)
1010

1111
sdk_logger&.error(LOGGER_PROGNAME) { message }
1212
rescue StandardError => e
13-
$stderr.puts "Sentry SDK logging failed (#{e.class}: #{message})"
13+
$stderr.puts "Sentry SDK logging failed (#{e.class}: #{e.message})"
1414
end
1515

1616
# @!visibility private
1717
def log_debug(message)
1818
sdk_logger&.debug(LOGGER_PROGNAME) { message }
1919
rescue StandardError => e
20-
$stderr.puts "Sentry SDK logging failed (#{e.class}: #{message})"
20+
$stderr.puts "Sentry SDK logging failed (#{e.class}: #{e.message})"
2121
end
2222

2323
# @!visibility private
2424
def log_warn(message)
2525
sdk_logger&.warn(LOGGER_PROGNAME) { message }
2626
rescue StandardError => e
27-
$stderr.puts "Sentry SDK logging failed (#{e.class}: #{message})"
27+
$stderr.puts "Sentry SDK logging failed (#{e.class}: #{e.message})"
2828
end
2929

3030
# @!visibility private

sentry-ruby/spec/sentry/utils/logging_helper_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def warn(*); raise IOError, "oops"; end
4646

4747
helper = helper_class.new(broken_logger)
4848

49-
expect($stderr).to receive(:puts).with(/Sentry SDK logging failed \(IOError: /)
49+
expect($stderr).to receive(:puts).with(/Sentry SDK logging failed \(IOError: oops\)/)
5050
expect { helper.public_send(method_name, *args) }.not_to raise_error
5151
end
5252
end

0 commit comments

Comments
 (0)