There are no gotos in this code
This commit is contained in:
parent
d08389bb9d
commit
89c873f9ef
@ -104,6 +104,10 @@ void AlbumCoverFetcher::AlbumSearchFinished() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
lastfm::XmlQuery query(lastfm::ws::parse(reply));
|
lastfm::XmlQuery query(lastfm::ws::parse(reply));
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||||
|
goto lastfm_error;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Parse the list of search results
|
// Parse the list of search results
|
||||||
QList<lastfm::XmlQuery> elements = query["results"]["albummatches"].children("album");
|
QList<lastfm::XmlQuery> elements = query["results"]["albummatches"].children("album");
|
||||||
@ -134,6 +138,9 @@ void AlbumCoverFetcher::AlbumSearchFinished() {
|
|||||||
|
|
||||||
active_requests_[image_reply] = request;
|
active_requests_[image_reply] = request;
|
||||||
} catch (std::runtime_error&) {
|
} catch (std::runtime_error&) {
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
lastfm_error:
|
||||||
|
#endif
|
||||||
if (request.search)
|
if (request.search)
|
||||||
emit SearchFinished(request.id, AlbumCoverFetcher::SearchResults());
|
emit SearchFinished(request.id, AlbumCoverFetcher::SearchResults());
|
||||||
else
|
else
|
||||||
|
@ -210,10 +210,17 @@ void LastFMService::AuthenticateReplyFinished() {
|
|||||||
// Parse the reply
|
// Parse the reply
|
||||||
try {
|
try {
|
||||||
lastfm::XmlQuery const lfm = lastfm::ws::parse(reply);
|
lastfm::XmlQuery const lfm = lastfm::ws::parse(reply);
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||||
|
goto lastfm_error;
|
||||||
|
#endif
|
||||||
|
|
||||||
lastfm::ws::Username = lfm["session"]["name"].text();
|
lastfm::ws::Username = lfm["session"]["name"].text();
|
||||||
lastfm::ws::SessionKey = lfm["session"]["key"].text();
|
lastfm::ws::SessionKey = lfm["session"]["key"].text();
|
||||||
} catch (std::runtime_error& e) {
|
} catch (std::runtime_error& e) {
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
lastfm_error:
|
||||||
|
#endif
|
||||||
qDebug() << e.what();
|
qDebug() << e.what();
|
||||||
emit AuthenticationComplete(false);
|
emit AuthenticationComplete(false);
|
||||||
return;
|
return;
|
||||||
@ -494,7 +501,14 @@ void LastFMService::RefreshFriendsFinished() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
friends = lastfm::User::list(reply);
|
friends = lastfm::User::list(reply);
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||||
|
goto lastfm_error;
|
||||||
|
#endif
|
||||||
} catch (std::runtime_error& e) {
|
} catch (std::runtime_error& e) {
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
lastfm_error:
|
||||||
|
#endif
|
||||||
qDebug() << e.what();
|
qDebug() << e.what();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -516,7 +530,14 @@ void LastFMService::RefreshNeighboursFinished() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
neighbours = lastfm::User::list(reply);
|
neighbours = lastfm::User::list(reply);
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||||
|
goto lastfm_error;
|
||||||
|
#endif
|
||||||
} catch (std::runtime_error& e) {
|
} catch (std::runtime_error& e) {
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
lastfm_error:
|
||||||
|
#endif
|
||||||
qDebug() << e.what();
|
qDebug() << e.what();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -625,6 +646,11 @@ void LastFMService::FetchMoreTracksFinished() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const XmlQuery& query = lastfm::ws::parse(reply);
|
const XmlQuery& query = lastfm::ws::parse(reply);
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (lastfm::ws::last_parse_error != lastfm::ws::NoError)
|
||||||
|
goto lastfm_error;
|
||||||
|
#endif
|
||||||
|
|
||||||
const XmlQuery& playlist = query["playlist"];
|
const XmlQuery& playlist = query["playlist"];
|
||||||
foreach (const XmlQuery& q, playlist["trackList"].children("track")) {
|
foreach (const XmlQuery& q, playlist["trackList"].children("track")) {
|
||||||
lastfm::MutableTrack t;
|
lastfm::MutableTrack t;
|
||||||
@ -640,6 +666,10 @@ void LastFMService::FetchMoreTracksFinished() {
|
|||||||
playlist_ << t;
|
playlist_ << t;
|
||||||
}
|
}
|
||||||
} catch (std::runtime_error& e) {
|
} catch (std::runtime_error& e) {
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
lastfm_error:
|
||||||
|
#endif
|
||||||
|
|
||||||
// For some reason a catch block that takes a lastfm::ws::ParseError&
|
// For some reason a catch block that takes a lastfm::ws::ParseError&
|
||||||
// doesn't get called, even when a lastfm::ws::ParseError is thrown...
|
// doesn't get called, even when a lastfm::ws::ParseError is thrown...
|
||||||
// Hacks like this remind me of Java...
|
// Hacks like this remind me of Java...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user