Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fail early and verbosely if we get invalid json back from the Phylobo…

…x API, #3
  • Loading branch information...
commit e3e71762aab70ac454af09404be6279d11487071 1 parent d051bbb
@leto authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/WWW/PhyloBox.pm
View
14 lib/WWW/PhyloBox.pm
@@ -51,11 +51,15 @@ is PhyloXML, but the Newick format is also marginally supported.
sub create {
my ($self, %args) = @_;
- my $response = $self->ua->post(
- $self->api_root . "/new",
- \%args,
- );
- my $json = $self->json->from_json( $response->content );
+ my $response = $self->ua->post( $self->api_root, \%args );
+ my $content = $response->content;
+
+ unless ($content) {
+ warn "Got empty content back from Phylobox API! Dumping response:";
+ use Data::Dumper; die Dumper [ $response ];
+ }
+
+ my $json = $self->json->from_json( $content );
return WWW::PhyloBox::Response->new( json => $json );
}
Please sign in to comment.
Something went wrong with that request. Please try again.