Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue where backtrace handling of exception classes that return nil message fails. #1500

Merged

Conversation

masato-hi
Copy link
Contributor

Raise a new TypeError when handling an exception class that returns an nil message.
Changed to always treat exception message as String.

The actual case is as follows.

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'

  gem 'ddtrace', '0.49.0', require: 'ddtrace'
  gem 'thrift', require: 'thrift'
end


class SomethingException < Thrift::Exception
  include Thrift::Struct
  FIELDS = {}
  def struct_fields; FIELDS; end
  Thrift::Struct.generate_accessors self
end

begin
  Datadog.tracer.trace('SomethingException') do
    raise SomethingException
  end
rescue SomethingException => e
  p 'nice catch!', e.message
end

@masato-hi masato-hi requested a review from a team May 14, 2021 05:46
@codecov-commenter
Copy link

Codecov Report

Merging #1500 (b2f6553) into master (339c1d2) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1500   +/-   ##
=======================================
  Coverage   98.22%   98.22%           
=======================================
  Files         863      863           
  Lines       41766    41779   +13     
=======================================
+ Hits        41024    41037   +13     
  Misses        742      742           
Impacted Files Coverage Δ
lib/ddtrace/error.rb 97.87% <100.00%> (ø)
spec/ddtrace/error_spec.rb 94.06% <100.00%> (+0.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 339c1d2...b2f6553. Read the comment docs.

@masato-hi masato-hi force-pushed the fix-tracer-handling-nil-message-error branch from 89c0c27 to ff17abb Compare May 14, 2021 07:25
Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this fix, @masato-hi! 🙇

@marcotc marcotc added bug Involves a bug core Involves Datadog core libraries labels May 17, 2021
@marcotc marcotc added this to Merged & awaiting release in Active work May 17, 2021
@marcotc marcotc merged commit aa28e48 into DataDog:master May 17, 2021
@github-actions github-actions bot added this to the 0.50.0 milestone May 17, 2021
@ivoanjo ivoanjo moved this from Merged & awaiting release to Released in Active work Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug core Involves Datadog core libraries
Projects
Active work
  
Released
Development

Successfully merging this pull request may close these issues.

None yet

3 participants