mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[editor] Stopped user preferences throwing an exception
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
committed by
Yannik Bloscheck
parent
7bfb488f1d
commit
9951ebece7
@@ -151,6 +151,7 @@ bool ServerApi06::TestOSMUser(std::string const & userName)
|
|||||||
|
|
||||||
UserPreferences ServerApi06::GetUserPreferences() const
|
UserPreferences ServerApi06::GetUserPreferences() const
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
OsmOAuth::Response const response = m_auth.Request("/user/details");
|
OsmOAuth::Response const response = m_auth.Request("/user/details");
|
||||||
if (response.first != OsmOAuth::HTTP::OK)
|
if (response.first != OsmOAuth::HTTP::OK)
|
||||||
MYTHROW(CantGetUserPreferences, (response));
|
MYTHROW(CantGetUserPreferences, (response));
|
||||||
@@ -171,6 +172,13 @@ UserPreferences ServerApi06::GetUserPreferences() const
|
|||||||
pref.m_changesets = user.child("changesets").attribute("count").as_uint();
|
pref.m_changesets = user.child("changesets").attribute("count").as_uint();
|
||||||
return pref;
|
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
|
OsmOAuth::Response ServerApi06::GetXmlFeaturesInRect(double minLat, double minLon, double maxLat, double maxLon) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ public:
|
|||||||
/// @returns true if user have registered/signed up even if his email address was not confirmed yet.
|
/// @returns true if user have registered/signed up even if his email address was not confirmed yet.
|
||||||
bool TestOSMUser(std::string const & userName);
|
bool TestOSMUser(std::string const & userName);
|
||||||
/// Get OSM user preferences in a convenient struct.
|
/// Get OSM user preferences in a convenient struct.
|
||||||
/// Throws in case of any error.
|
|
||||||
UserPreferences GetUserPreferences() const;
|
UserPreferences GetUserPreferences() const;
|
||||||
/// Please use at least created_by=* and comment=* tags.
|
/// Please use at least created_by=* and comment=* tags.
|
||||||
/// @returns created changeset ID.
|
/// @returns created changeset ID.
|
||||||
|
|||||||
Reference in New Issue
Block a user