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

Implement Exception#inspect #5008

Merged
merged 1 commit into from Sep 20, 2017
Merged

Implement Exception#inspect #5008

merged 1 commit into from Sep 20, 2017

Conversation

asterite
Copy link
Member

Code:

begin
  raise "OH NO!"
rescue ex
  p ex
end

Output before:

#<Exception:0x108379d40
 @callstack=
  CallStack(
   @backtrace=nil,
   @callstack=
    [Pointer(Void)@0x107f36525,
     Pointer(Void)@0x107f364c1,
     Pointer(Void)@0x107f36498,
     Pointer(Void)@0x107f25955,
     Pointer(Void)@0x107f25901,
     Pointer(Void)@0x107f253bd,
     Pointer(Void)@0x107f354d8]),
 @cause=nil,
 @message="OH NO">

Output after:

#<Exception:OH NO>

Ruby also uses the same format.

I considered showing the backtrace here but I think it's not relevant to inspect (that's probably why Ruby doesn't show it either).

@RX14 RX14 added this to the Next milestone Sep 20, 2017
@RX14 RX14 merged commit 12ed6df into crystal-lang:master Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants