Catch echonest errors properly

This commit is contained in:
David Sansome 2010-10-09 10:32:18 +00:00
parent fbb62a2f43
commit 81fb559f66
2 changed files with 8 additions and 3 deletions

View File

@ -32,8 +32,8 @@ void Echonest::Parser::checkForErrors( QNetworkReply* reply ) throw( Echonest::P
// throw ParseError( Echonest::UnfinishedQuery );
//
if( reply->error() != QNetworkReply::NoError ) {
ParseError* err = new ParseError( Echonest::NetworkError );
err->setNetworkError( reply->error() );
ParseError err( Echonest::NetworkError );
err.setNetworkError( reply->error() );
throw err;
}

View File

@ -55,7 +55,12 @@ EchoNestArtistInfo::RequestPtr EchoNestArtistInfo::ReplyFinished(QNetworkReply*
foreach (RequestPtr request, requests_) {
if (request->pending_replies_.contains(reply)) {
request->artist_->parseProfile(reply);
try {
request->artist_->parseProfile(reply);
} catch (Echonest::ParseError e) {
qWarning() << "Error parsing echonest reply:" << e.errorType() << e.what();
}
request->pending_replies_.removeAll(reply);
if (request->pending_replies_.isEmpty()) {