Created
April 5, 2018 09:00
-
-
Save nicomen/312fb3ceea10aac3cc3e7af2693faede to your computer and use it in GitHub Desktop.
Mojo::CarpAlways
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package MojoCarpAlways; | |
use Mojo::Base -strict; | |
use Mojo::Exception; | |
*Mojo::Exception::to_string = sub { | |
my $self = shift; | |
my $str = $self->message; | |
$str .= join "\n", map { " $_->[1]: " . $_->[2] } @{ $self->frames }; | |
return $str unless $self->verbose; | |
$str .= "\n" unless $str =~ /\n$/; | |
$str .= $_->[0] . ': ' . $_->[1] . "\n" for @{$self->lines_before}; | |
$str .= $self->line->[0] . ': ' . $self->line->[1] . "\n" if $self->line->[0]; | |
$str .= $_->[0] . ': ' . $_->[1] . "\n" for @{$self->lines_after}; | |
return $str; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment