[editor] Stopped user preferences throwing an exception

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-07-05 10:47:49 +02:00
committed by Yannik Bloscheck
parent 7bfb488f1d
commit 9951ebece7
2 changed files with 24 additions and 17 deletions

View File

@@ -151,6 +151,7 @@ bool ServerApi06::TestOSMUser(std::string const & userName)
UserPreferences ServerApi06::GetUserPreferences() const
{
try {
OsmOAuth::Response const response = m_auth.Request("/user/details");
if (response.first != OsmOAuth::HTTP::OK)
MYTHROW(CantGetUserPreferences, (response));
@@ -170,6 +171,13 @@ UserPreferences ServerApi06::GetUserPreferences() const
pref.m_imageUrl = user.child("img").attribute("href").as_string();
pref.m_changesets = user.child("changesets").attribute("count").as_uint();
return pref;
}
catch (std::exception const & e)
{
LOG(LWARNING, ("Can't load user preferences from server: ", e.what()));
}
return {};
}
OsmOAuth::Response ServerApi06::GetXmlFeaturesInRect(double minLat, double minLon, double maxLat, double maxLon) const

View File

@@ -50,7 +50,6 @@ public:
/// @returns true if user have registered/signed up even if his email address was not confirmed yet.
bool TestOSMUser(std::string const & userName);
/// Get OSM user preferences in a convenient struct.
/// Throws in case of any error.
UserPreferences GetUserPreferences() const;
/// Please use at least created_by=* and comment=* tags.
/// @returns created changeset ID.