Skip to content

Commit

Permalink
Merge remote-tracking branch 'rikbrown/devel' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
dams committed Dec 25, 2012
2 parents ae8426c + 991d100 commit 2293ba3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/Dancer/Error.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package Dancer::Error;
use strict;
use warnings;
use Carp;
use Scalar::Util qw(blessed);

use base 'Dancer::Object';

Expand Down Expand Up @@ -206,8 +207,15 @@ sub _render_serialized {

my $message =
!ref $self->message ? {error => $self->message} : $self->message;
ref $message eq 'HASH' && defined $self->exception
and $message->{exception} = $self->exception;

if (ref $message eq 'HASH' && defined $self->exception) {
if (blessed($self->exception)) {
$message->{exception} = ref($self->exception);
$message->{exception} =~ s/^Dancer::Exception:://;
} else {
$message->{exception} = $self->exception;
}
}

if (setting('show_errors')) {
Dancer::Response->new(
Expand Down

0 comments on commit 2293ba3

Please sign in to comment.