Permalink
Browse files

Error checking for mbz_download_file

  • Loading branch information...
1 parent a0ed84a commit 8bdcc6c577f230a58ace50b9e76cf4c50d5d9656 Vadim Shetinin committed Nov 5, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/functions.pl
View
@@ -104,7 +104,12 @@ sub mbz_download_file {
my $ua = LWP::UserAgent->new();
my $request = HTTP::Request->new('GET', $_[0]);
my $resp = $ua->request($request, $_[1]);
- return $resp;
+
+ if( $resp->is_success ) {
+ return $resp;
+ } else {
+ die 'Error downloading ' . $_[0] . ': ' . $resp->status_line;
+ }
}

0 comments on commit 8bdcc6c

Please sign in to comment.