summaryrefslogtreecommitdiff
path: root/spec/ruby/command_line/fixtures/backtrace.rb
blob: 99acae95c894ee06832a8a5aa2f1bc5c6fe84d42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def a
  raise 'oops'
end

def b
  a
end

def c
  b
end

def d
  c
end

arg = ARGV.first
$stderr.puts arg

case arg
when 'full_message'
  begin
    d
  rescue => exc
    puts exc.full_message
  end
when 'backtrace'
  begin
    d
  rescue => exc
    puts exc.backtrace
  end
else
  d
end