D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Exception
/
Filename :
backtrace-i.ri
back
Copy
U:RDoc::AnyMethod[iI"backtrace:ETI"Exception#backtrace;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"SReturns the backtrace (the list of code locations that led to the exception), ;TI"as an array of strings.;To:RDoc::Markup::BlankLine o; ; [I"KExample (assuming the code is stored in the file named <tt>t.rb</tt>):;T@o:RDoc::Markup::Verbatim; [I"*def division(numerator, denominator) ;TI" numerator / denominator ;TI" end ;TI" ;TI"begin ;TI" division(1, 0) ;TI"rescue => ex ;TI" p ex.backtrace ;TI"X # ["t.rb:2:in 'Integer#/'", "t.rb:2:in 'Object#division'", "t.rb:6:in '<main>'"] ;TI" loc = ex.backtrace.first ;TI" p loc.class ;TI" # String ;TI" end ;T:@format0o; ; [I"ZThe value returned by this method migth be adjusted when raising (see Kernel#raise), ;TI"7or during intermediate handling by #set_backtrace.;T@o; ; [I"WSee also #backtrace_locations that provide the same value, as structured objects. ;TI"O(Note though that two values might not be consistent with each other when ;TI"'backtraces are manually adjusted.);T@o; ; [I"9see {Backtraces}[rdoc-ref:exceptions.md@Backtraces].;T: @fileI"error.c;T:0@omit_headings_from_table_of_contents_below0I"backtrace -> array or nil ;T0[ I"();T@.FI"Exception;TcRDoc::NormalClass00