Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save techwhizbang/486474 to your computer and use it in GitHub Desktop.
Save techwhizbang/486474 to your computer and use it in GitHub Desktop.
module API
module ServiceCall
protected
def service_call(&block)
begin
puts "in begin block"
raise "exception occurred here"
parse_response(yield) if block_given?
rescue Exception => e
puts "in the rescue block"
api_exception = API::Exception.new(e.message)
api_exception.set_backtrace(e.backtrace)
raise api_exception
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment