Skip to content

Instantly share code, notes, and snippets.

@dagolden
Created April 22, 2010 17:57
Show Gist options
  • Save dagolden/375566 to your computer and use it in GitHub Desktop.
Save dagolden/375566 to your computer and use it in GitHub Desktop.
--- lib/Metabase/Client/Simple.pm 2010-04-22 13:56:38.000000000 -0400
+++ lib/Metabase/Client/Simple.pm.orig 2010-04-22 13:55:00.000000000 -0400
@@ -183,9 +183,8 @@
my ($self, $res, $prefix) = @_;
$prefix ||= "unrecognized error";
if ( ref($res) && $res->header('Content-Type') eq 'application/json') {
- my $entity = eval { JSON->new->ascii->decode($res->content) };
- my $msg = $entity ? $entity->{error} : $res->content;
- return "$prefix\: $msg";
+ my $entity = JSON->new->ascii->decode($res->content);
+ return "$prefix\: $entity->{error}";
} else {
return "$prefix\: " . $res->message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment