summary refs log tree commit diff
path: root/src/ui
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-01-09 02:06:49 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-01-09 02:06:49 +0100
commitb84bc7895e5d531bf01c316d27aa87151e9eab6d (patch)
tree386557b7ea3c97b8b2aa5ca3fadca7ebad46c398 /src/ui
parentMake server connection errors more useful (diff)
downloadnheko-b84bc7895e5d531bf01c316d27aa87151e9eab6d.tar.xz
Add some more error logging
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/UserProfile.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/ui/UserProfile.cpp b/src/ui/UserProfile.cpp
index ca222d8b..5f39e35a 100644
--- a/src/ui/UserProfile.cpp
+++ b/src/ui/UserProfile.cpp
@@ -190,9 +190,7 @@ UserProfile::fetchDeviceList(const QString &userID)
       [other_user_id = userID.toStdString(), this](const UserKeyCache &,
                                                    mtx::http::RequestErr err) {
           if (err) {
-              nhlog::net()->warn("failed to query device keys: {},{}",
-                                 mtx::errors::to_string(err->matrix_error.errcode),
-                                 static_cast<int>(err->status_code));
+              nhlog::net()->warn("failed to query device keys: {}", *err);
           }
 
           // Ensure local key cache is up to date
@@ -203,9 +201,7 @@ UserProfile::fetchDeviceList(const QString &userID)
                 std::string local_user_id = utils::localUser().toStdString();
 
                 if (err) {
-                    nhlog::net()->warn("failed to query device keys: {},{}",
-                                       mtx::errors::to_string(err->matrix_error.errcode),
-                                       static_cast<int>(err->status_code));
+                    nhlog::net()->warn("failed to query device keys: {}", *err);
                 }
 
                 emit verificationStatiChanged();
@@ -261,9 +257,7 @@ UserProfile::updateVerificationStatus()
           [this, deviceInfo](const mtx::responses::QueryDevices &allDevs,
                              mtx::http::RequestErr err) mutable {
               if (err) {
-                  nhlog::net()->warn("failed to query devices: {} {}",
-                                     err->matrix_error.error,
-                                     static_cast<int>(err->status_code));
+                  nhlog::net()->warn("failed to query device keys: {}", *err);
                   this->deviceList_.queueReset(std::move(deviceInfo));
                   emit devicesChanged();
                   return;
@@ -335,7 +329,7 @@ UserProfile::changeUsername(const QString &username)
         // change global
         http::client()->set_displayname(username.toStdString(), [](mtx::http::RequestErr err) {
             if (err) {
-                nhlog::net()->warn("could not change username");
+                nhlog::net()->warn("could not change username: {}", *err);
                 return;
             }
         });
@@ -358,7 +352,7 @@ UserProfile::changeDeviceName(const QString &deviceID, const QString &deviceName
     http::client()->set_device_name(
       deviceID.toStdString(), deviceName.toStdString(), [this](mtx::http::RequestErr err) {
           if (err) {
-              nhlog::net()->warn("could not change device name");
+              nhlog::net()->warn("could not change device name: {}", *err);
               return;
           }
           refreshDevices();
@@ -434,14 +428,14 @@ UserProfile::changeAvatar()
        room_id  = roomid_.toStdString(),
        content = std::move(bin)](const mtx::responses::ContentURI &res, mtx::http::RequestErr err) {
           if (err) {
-              nhlog::ui()->error("Failed to upload image", err->matrix_error.error);
+              nhlog::ui()->error("Failed to upload image: {}", *err);
               return;
           }
 
           if (isGlobalUserProfile()) {
               http::client()->set_avatar_url(res.content_uri, [this](mtx::http::RequestErr err) {
                   if (err) {
-                      nhlog::ui()->error("Failed to set user avatar url", err->matrix_error.error);
+                      nhlog::ui()->error("Failed to set user avatar url: {}", *err);
                   }
 
                   isLoading_ = false;
@@ -463,14 +457,14 @@ UserProfile::changeAvatar()
 void
 UserProfile::updateRoomMemberState(mtx::events::state::Member member)
 {
-    http::client()->send_state_event(
-      roomid_.toStdString(),
-      http::client()->user_id().to_string(),
-      member,
-      [](mtx::responses::EventId, mtx::http::RequestErr err) {
-          if (err)
-              nhlog::net()->error("Failed to update room member state : ", err->matrix_error.error);
-      });
+    http::client()->send_state_event(roomid_.toStdString(),
+                                     http::client()->user_id().to_string(),
+                                     member,
+                                     [](mtx::responses::EventId, mtx::http::RequestErr err) {
+                                         if (err)
+                                             nhlog::net()->error(
+                                               "Failed to update room member state: {}", *err);
+                                     });
 }
 
 void