Skip to content

Commit

Permalink
Item14237: Merge commit 'c8884849de4c5db54b00011fa201898a91e7e8dc' in…
Browse files Browse the repository at this point in the history
…to Item14237

* commit 'c8884849de4c5db54b00011fa201898a91e7e8dc':
  Item13897: A bit of improvement to stringify()
  • Loading branch information
vrurg committed Dec 1, 2016
2 parents ceff4cf + c888484 commit aec4010
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions core/lib/Foswiki/Exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ use Foswiki::Class;
extends qw(Foswiki::Object);
with 'Throwable';

#use overload '""' => 'to_str';

our $EXCEPTION_TRACE = 0;

=begin TML
Expand Down Expand Up @@ -174,18 +172,23 @@ sub BUILD {
if DEBUG && $EXCEPTION_TRACE;
}

sub stringify {
sub stringifyPostfix {
my $this = shift;

return $this->text
. (
return (
DEBUG
? "\n" . $this->stacktrace
: ' at ' . $this->file . ' line ' . $this->line
);
);
}

sub stringify {
my $this = shift;

return $this->text . $this->stringifyPostfix;
}

around to_str => sub {
my $orig = shift;
my $this = shift;

my $boundary = '-' x 60;
Expand Down Expand Up @@ -563,7 +566,7 @@ around stringify => sub {
$res->print( $this->status . " "
. $this->header . "\n\n"
. $this->text
. ( DEBUG ? $this->stacktrace : '' ) );
. $this->stringifyPostfix );
}

return $orig->($this);
Expand Down

0 comments on commit aec4010

Please sign in to comment.