Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
move some code that belongs in Backtrace
  • Loading branch information
TimToady committed Apr 15, 2015
1 parent 06dfca6 commit a7b45b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/core/Backtrace.pm
Expand Up @@ -31,8 +31,10 @@ my class Backtrace::Frame {
my class Backtrace is List {
proto method new(|) {*}

multi method new(Exception $e, Int $offset = 0) {
self.new(nqp::backtrace(nqp::getattr(nqp::decont($e), Exception, '$!ex')), $offset);
multi method new(Mu $e, Int $offset = 0) {
$e.^name eq 'BOOTException'
?? self.new(nqp::backtrace(nqp::decont($e)), $offset)
!! self.new(nqp::backtrace(nqp::getattr(nqp::decont($e), Exception, '$!ex')), $offset);
}

multi method new(Int $offset = 0) {
Expand Down
10 changes: 1 addition & 9 deletions src/core/Exception.pm
Expand Up @@ -8,15 +8,7 @@ my class Exception {

method backtrace() {
if $!bt { $!bt }
elsif nqp::isconcrete($!ex) {
if $!ex.^name eq 'BOOTException' {
" Only a low-level backtrace is available here:\n "
~ nqp::join("\n ", nqp::backtracestrings($!ex));
}
else {
Backtrace.new(nqp::decont($!ex));
}
}
elsif nqp::isconcrete($!ex) { Backtrace.new($!ex); }
else { '' }
}

Expand Down

0 comments on commit a7b45b6

Please sign in to comment.