Skip to content

Commit

Permalink
Use Exception#inspect_with_backtrace where sensible (#6261)
Browse files Browse the repository at this point in the history
  • Loading branch information
RX14 authored and Serdar Dogruyol committed Jun 25, 2018
1 parent b700ad9 commit fc01468
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 1 addition & 5 deletions src/compiler/crystal/command.cr
Expand Up @@ -115,11 +115,7 @@ class Crystal::Command
rescue ex : OptionParser::Exception
error ex.message
rescue ex
STDERR.puts ex
ex.backtrace.each do |frame|
STDERR.puts frame
end
STDERR.puts
ex.inspect_with_backtrace STDERR
error "you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues"
end

Expand Down
9 changes: 2 additions & 7 deletions src/spec/context.cr
Expand Up @@ -82,16 +82,11 @@ module Spec
end
puts

ex.to_s.split('\n').each do |line|
message = ex.is_a?(AssertionFailed) ? ex.to_s : ex.inspect_with_backtrace
message.split('\n').each do |line|
print " "
puts Spec.color(line, :error)
end
unless ex.is_a?(AssertionFailed)
ex.backtrace.each do |trace|
print " "
puts Spec.color(trace, :error)
end
end

if ex.is_a?(AssertionFailed)
puts
Expand Down

0 comments on commit fc01468

Please sign in to comment.