Skip to content

Instantly share code, notes, and snippets.

@dentarg
Created August 13, 2014 13:24
Show Gist options
  • Save dentarg/d1a582e7c132b563ced5 to your computer and use it in GitHub Desktop.
Save dentarg/d1a582e7c132b563ced5 to your computer and use it in GitHub Desktop.
irb(main):011:0> class ApiError < StandardError; end
=> nil
irb(main):012:0> begin
irb(main):013:1* raise ApiError, "lala"
irb(main):014:1> rescue StandardError => e
irb(main):015:1> puts e.name
irb(main):016:1> end
NoMethodError: undefined method `name' for #<ApiError: lala>
from (irb):15:in `rescue in irb_binding'
from (irb):12
from /Users/dentarg/.rubies/ruby-2.1.2/bin/irb:11:in `<main>'
irb(main):017:0> ApiError
=> ApiError
irb(main):018:0> ApiError.name
=> "ApiError"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment