mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
backtrace and backtrace_locations can be nil (#2358)
Exception#backtrace and Exception#backtrace_locations can both be nil if not set. The former can be set via `Exception#set_backtrace`, but the later is only ever set at runtime via `setup_backtrace`.
This commit is contained in:
parent
48e9155e65
commit
7da40d74e1
1 changed files with 9 additions and 3 deletions
12
error.c
12
error.c
|
@ -1114,7 +1114,7 @@ exc_inspect(VALUE exc)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* exception.backtrace -> array
|
* exception.backtrace -> array or nil
|
||||||
*
|
*
|
||||||
* Returns any backtrace associated with the exception. The backtrace
|
* Returns any backtrace associated with the exception. The backtrace
|
||||||
* is an array of strings, each containing either ``filename:lineNo: in
|
* is an array of strings, each containing either ``filename:lineNo: in
|
||||||
|
@ -1139,6 +1139,12 @@ exc_inspect(VALUE exc)
|
||||||
* prog.rb:2:in `a'
|
* prog.rb:2:in `a'
|
||||||
* prog.rb:6:in `b'
|
* prog.rb:6:in `b'
|
||||||
* prog.rb:10
|
* prog.rb:10
|
||||||
|
*
|
||||||
|
* In the case no backtrace has been set, +nil+ is returned
|
||||||
|
*
|
||||||
|
* ex = StandardError.new
|
||||||
|
* ex.backtrace
|
||||||
|
* #=> nil
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1179,13 +1185,13 @@ rb_get_backtrace(VALUE exc)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* exception.backtrace_locations -> array
|
* exception.backtrace_locations -> array or nil
|
||||||
*
|
*
|
||||||
* Returns any backtrace associated with the exception. This method is
|
* Returns any backtrace associated with the exception. This method is
|
||||||
* similar to Exception#backtrace, but the backtrace is an array of
|
* similar to Exception#backtrace, but the backtrace is an array of
|
||||||
* Thread::Backtrace::Location.
|
* Thread::Backtrace::Location.
|
||||||
*
|
*
|
||||||
* Now, this method is not affected by Exception#set_backtrace().
|
* This method is not affected by Exception#set_backtrace().
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
exc_backtrace_locations(VALUE exc)
|
exc_backtrace_locations(VALUE exc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue