From a84814b8e1376ac51b93cda6d6188a40c6066205 Mon Sep 17 00:00:00 2001 From: David Golden Date: Mon, 1 Mar 2010 15:36:29 -0500 Subject: [PATCH] add diagnostics on JSON failures --- lib/Metabase/Report.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Metabase/Report.pm b/lib/Metabase/Report.pm index b095122..9c624ae 100644 --- a/lib/Metabase/Report.pm +++ b/lib/Metabase/Report.pm @@ -124,7 +124,9 @@ sub content_as_bytes { Carp::confess("can't serialize an open report") unless $self->{__closed}; my $content = [ map { $_->as_struct } @{ $self->content } ]; - JSON->new->encode( $content ); + my $encoded = eval { JSON->new->encode( $content ) }; + Carp::confess $@ if $@; + return $encoded; } sub content_from_bytes {