Skip to content

Instantly share code, notes, and snippets.

@ryangreenberg
Created March 20, 2014 22:51
Show Gist options
  • Save ryangreenberg/9675712 to your computer and use it in GitHub Desktop.
Save ryangreenberg/9675712 to your computer and use it in GitHub Desktop.
thrift_client wrapped exceptions
#!/usr/bin/env ruby -KU
require 'rubygems'
require 'thrift'
ex = Thrift::TransportException.new(Thrift::TransportException::NOT_OPEN, "it was not open")
wrapped_ex = begin
raise Thrift::TransportException, ex.message, ex.backtrace
rescue StandardError => e
e
end
puts "ex: #{(ex).inspect}" # => ex: #<Thrift::TransportException: it was not open>
puts "wrapped_ex: #{(wrapped_ex).inspect}" # => wrapped_ex: #<Thrift::TransportException: Thrift::TransportException>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment