Add some more error logging

This commit is contained in:
Nicolas Werner 2023-01-09 02:06:49 +01:00
parent 1d4b5e40a3
commit b84bc7895e
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
3 changed files with 18 additions and 26 deletions

View file

@ -1381,9 +1381,7 @@ ChatPage::decryptDownloadedSecrets(mtx::secret_storage::AesHmacSha2KeyDescriptio
http::client()->keys_signatures_upload( http::client()->keys_signatures_upload(
req, [](const mtx::responses::KeySignaturesUpload &res, mtx::http::RequestErr err) { req, [](const mtx::responses::KeySignaturesUpload &res, mtx::http::RequestErr err) {
if (err) { if (err) {
nhlog::net()->error("failed to upload signatures: {},{}", nhlog::net()->error("failed to upload signatures: {}", *err);
mtx::errors::to_string(err->matrix_error.errcode),
static_cast<int>(err->status_code));
} }
for (const auto &[user_id, tmp] : res.errors) for (const auto &[user_id, tmp] : res.errors)

View file

@ -138,8 +138,8 @@ handle_to_device_messages(const std::vector<mtx::events::collections::DeviceEven
cache::client()->query_keys( cache::client()->query_keys(
olm_msg.sender, [olm_msg](const UserKeyCache &userKeys, mtx::http::RequestErr e) { olm_msg.sender, [olm_msg](const UserKeyCache &userKeys, mtx::http::RequestErr e) {
if (e) { if (e) {
nhlog::crypto()->error("Failed to query user keys, dropping olm " nhlog::crypto()->error(
"message"); "Failed to query user keys, dropping olm message: {}", e);
return; return;
} }
handle_olm_message(std::move(olm_msg), userKeys); handle_olm_message(std::move(olm_msg), userKeys);

View file

@ -190,9 +190,7 @@ UserProfile::fetchDeviceList(const QString &userID)
[other_user_id = userID.toStdString(), this](const UserKeyCache &, [other_user_id = userID.toStdString(), this](const UserKeyCache &,
mtx::http::RequestErr err) { mtx::http::RequestErr err) {
if (err) { if (err) {
nhlog::net()->warn("failed to query device keys: {},{}", nhlog::net()->warn("failed to query device keys: {}", *err);
mtx::errors::to_string(err->matrix_error.errcode),
static_cast<int>(err->status_code));
} }
// Ensure local key cache is up to date // 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(); std::string local_user_id = utils::localUser().toStdString();
if (err) { if (err) {
nhlog::net()->warn("failed to query device keys: {},{}", nhlog::net()->warn("failed to query device keys: {}", *err);
mtx::errors::to_string(err->matrix_error.errcode),
static_cast<int>(err->status_code));
} }
emit verificationStatiChanged(); emit verificationStatiChanged();
@ -261,9 +257,7 @@ UserProfile::updateVerificationStatus()
[this, deviceInfo](const mtx::responses::QueryDevices &allDevs, [this, deviceInfo](const mtx::responses::QueryDevices &allDevs,
mtx::http::RequestErr err) mutable { mtx::http::RequestErr err) mutable {
if (err) { if (err) {
nhlog::net()->warn("failed to query devices: {} {}", nhlog::net()->warn("failed to query device keys: {}", *err);
err->matrix_error.error,
static_cast<int>(err->status_code));
this->deviceList_.queueReset(std::move(deviceInfo)); this->deviceList_.queueReset(std::move(deviceInfo));
emit devicesChanged(); emit devicesChanged();
return; return;
@ -335,7 +329,7 @@ UserProfile::changeUsername(const QString &username)
// change global // change global
http::client()->set_displayname(username.toStdString(), [](mtx::http::RequestErr err) { http::client()->set_displayname(username.toStdString(), [](mtx::http::RequestErr err) {
if (err) { if (err) {
nhlog::net()->warn("could not change username"); nhlog::net()->warn("could not change username: {}", *err);
return; return;
} }
}); });
@ -358,7 +352,7 @@ UserProfile::changeDeviceName(const QString &deviceID, const QString &deviceName
http::client()->set_device_name( http::client()->set_device_name(
deviceID.toStdString(), deviceName.toStdString(), [this](mtx::http::RequestErr err) { deviceID.toStdString(), deviceName.toStdString(), [this](mtx::http::RequestErr err) {
if (err) { if (err) {
nhlog::net()->warn("could not change device name"); nhlog::net()->warn("could not change device name: {}", *err);
return; return;
} }
refreshDevices(); refreshDevices();
@ -434,14 +428,14 @@ UserProfile::changeAvatar()
room_id = roomid_.toStdString(), room_id = roomid_.toStdString(),
content = std::move(bin)](const mtx::responses::ContentURI &res, mtx::http::RequestErr err) { content = std::move(bin)](const mtx::responses::ContentURI &res, mtx::http::RequestErr err) {
if (err) { if (err) {
nhlog::ui()->error("Failed to upload image", err->matrix_error.error); nhlog::ui()->error("Failed to upload image: {}", *err);
return; return;
} }
if (isGlobalUserProfile()) { if (isGlobalUserProfile()) {
http::client()->set_avatar_url(res.content_uri, [this](mtx::http::RequestErr err) { http::client()->set_avatar_url(res.content_uri, [this](mtx::http::RequestErr err) {
if (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; isLoading_ = false;
@ -463,13 +457,13 @@ UserProfile::changeAvatar()
void void
UserProfile::updateRoomMemberState(mtx::events::state::Member member) UserProfile::updateRoomMemberState(mtx::events::state::Member member)
{ {
http::client()->send_state_event( http::client()->send_state_event(roomid_.toStdString(),
roomid_.toStdString(),
http::client()->user_id().to_string(), http::client()->user_id().to_string(),
member, member,
[](mtx::responses::EventId, mtx::http::RequestErr err) { [](mtx::responses::EventId, mtx::http::RequestErr err) {
if (err) if (err)
nhlog::net()->error("Failed to update room member state : ", err->matrix_error.error); nhlog::net()->error(
"Failed to update room member state: {}", *err);
}); });
} }