0
This commit is contained in:
Kaimi
2016-01-26 16:39:30 +03:00
parent 02172b17ab
commit ac3f3dacaf

View File

@@ -559,6 +559,7 @@ sub get_album_tracks_info
if(!$json_data) if(!$json_data)
{ {
info(DEBUG, 'Can\'t parse JSON blob'); info(DEBUG, 'Can\'t parse JSON blob');
log_response($request);
return; return;
} }
@@ -566,6 +567,7 @@ sub get_album_tracks_info
if(!$json) if(!$json)
{ {
info(DEBUG, 'Can\'t create json from data: ' . $@); info(DEBUG, 'Can\'t create json from data: ' . $@);
log_response($request);
return; return;
} }
@@ -616,6 +618,7 @@ sub get_playlist_tracks_info
if(!$json_data) if(!$json_data)
{ {
info(DEBUG, 'Can\'t parse JSON blob'); info(DEBUG, 'Can\'t parse JSON blob');
log_response($request);
return; return;
} }
@@ -623,6 +626,7 @@ sub get_playlist_tracks_info
if(!$json) if(!$json)
{ {
info(DEBUG, 'Can\'t create json from data: ' . $@); info(DEBUG, 'Can\'t create json from data: ' . $@);
log_response($request);
return; return;
} }
@@ -681,6 +685,7 @@ sub get_playlist_tracks_info
if(!$json) if(!$json)
{ {
info(DEBUG, 'Can\'t create json from data'); info(DEBUG, 'Can\'t create json from data');
log_response($request);
return; return;
} }
@@ -1011,16 +1016,19 @@ sub read_file
sub log_response sub log_response
{ {
my $response = shift; my $response = shift;
return if !$opt{debug};
my $log_filename = RESPONSE_LOG_PREFIX . time; my $log_filename = RESPONSE_LOG_PREFIX . time;
if(open(my $fh, '>', $log_filename)) if(open(my $fh, '>', $log_filename))
{ {
binmode $fh; binmode $fh;
print $fh, $response->as_string; print $fh $response->as_string;
close $fh; close $fh;
info(DEBUG, 'Response stored at ' . $log_filename); info(DEBUG, 'Response stored at ' . $log_filename);
} }
else
{
info(DEBUG, 'Failed to store response stored at ' . $log_filename); info(DEBUG, 'Failed to store response stored at ' . $log_filename);
}
} }