mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
On second thoughts, lose the gotos and handle the last.fm errors by throwing.
This commit is contained in:
parent
89c873f9ef
commit
0a7fa788b3
@ -106,7 +106,7 @@ void AlbumCoverFetcher::AlbumSearchFinished() {
|
||||
lastfm::XmlQuery query(lastfm::ws::parse(reply));
|
||||
#ifdef Q_OS_WIN32
|
||||
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||
goto lastfm_error;
|
||||
throw std::runtime_error("");
|
||||
#endif
|
||||
|
||||
// Parse the list of search results
|
||||
@ -138,9 +138,6 @@ void AlbumCoverFetcher::AlbumSearchFinished() {
|
||||
|
||||
active_requests_[image_reply] = request;
|
||||
} catch (std::runtime_error&) {
|
||||
#ifdef Q_OS_WIN32
|
||||
lastfm_error:
|
||||
#endif
|
||||
if (request.search)
|
||||
emit SearchFinished(request.id, AlbumCoverFetcher::SearchResults());
|
||||
else
|
||||
|
@ -212,15 +212,12 @@ void LastFMService::AuthenticateReplyFinished() {
|
||||
lastfm::XmlQuery const lfm = lastfm::ws::parse(reply);
|
||||
#ifdef Q_OS_WIN32
|
||||
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||
goto lastfm_error;
|
||||
throw std::runtime_error("");
|
||||
#endif
|
||||
|
||||
lastfm::ws::Username = lfm["session"]["name"].text();
|
||||
lastfm::ws::SessionKey = lfm["session"]["key"].text();
|
||||
} catch (std::runtime_error& e) {
|
||||
#ifdef Q_OS_WIN32
|
||||
lastfm_error:
|
||||
#endif
|
||||
qDebug() << e.what();
|
||||
emit AuthenticationComplete(false);
|
||||
return;
|
||||
@ -503,12 +500,9 @@ void LastFMService::RefreshFriendsFinished() {
|
||||
friends = lastfm::User::list(reply);
|
||||
#ifdef Q_OS_WIN32
|
||||
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||
goto lastfm_error;
|
||||
throw std::runtime_error("");
|
||||
#endif
|
||||
} catch (std::runtime_error& e) {
|
||||
#ifdef Q_OS_WIN32
|
||||
lastfm_error:
|
||||
#endif
|
||||
qDebug() << e.what();
|
||||
return;
|
||||
}
|
||||
@ -532,12 +526,9 @@ void LastFMService::RefreshNeighboursFinished() {
|
||||
neighbours = lastfm::User::list(reply);
|
||||
#ifdef Q_OS_WIN32
|
||||
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||
goto lastfm_error;
|
||||
throw std::runtime_error("");
|
||||
#endif
|
||||
} catch (std::runtime_error& e) {
|
||||
#ifdef Q_OS_WIN32
|
||||
lastfm_error:
|
||||
#endif
|
||||
qDebug() << e.what();
|
||||
return;
|
||||
}
|
||||
@ -648,7 +639,7 @@ void LastFMService::FetchMoreTracksFinished() {
|
||||
const XmlQuery& query = lastfm::ws::parse(reply);
|
||||
#ifdef Q_OS_WIN32
|
||||
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||
goto lastfm_error;
|
||||
throw std::runtime_error("");
|
||||
#endif
|
||||
|
||||
const XmlQuery& playlist = query["playlist"];
|
||||
@ -666,10 +657,6 @@ void LastFMService::FetchMoreTracksFinished() {
|
||||
playlist_ << t;
|
||||
}
|
||||
} catch (std::runtime_error& e) {
|
||||
#ifdef Q_OS_WIN32
|
||||
lastfm_error:
|
||||
#endif
|
||||
|
||||
// For some reason a catch block that takes a lastfm::ws::ParseError&
|
||||
// doesn't get called, even when a lastfm::ws::ParseError is thrown...
|
||||
// Hacks like this remind me of Java...
|
||||
|
Loading…
x
Reference in New Issue
Block a user