Track all errors in Sentry

This commit is contained in:
Andy Uhnak
2022-08-22 10:20:36 +01:00
parent 30cb697304
commit a9d1e84252
44 changed files with 128 additions and 74 deletions
@@ -1365,7 +1365,9 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
{
if (event.eventType != MXEventTypeBeaconInfo)
{
MXLogError(@"[RoomBubbleCellData] Try to update beacon info summary with wrong event type with event id %@", eventId);
MXLogErrorDetails(@"[RoomBubbleCellData] Try to update beacon info summary with wrong event type", @{
@"event_id": eventId ?: @"unknown"
});
return;
}
@@ -1378,7 +1380,9 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
// A start beacon info event (isLive == true) should have an associated BeaconInfoSummary
if (beaconInfo && beaconInfo.isLive)
{
MXLogError(@"[RoomBubbleCellData] No beacon info summary found for beacon info start event with id %@", eventId);
MXLogErrorDetails(@"[RoomBubbleCellData] No beacon info summary found for beacon info start event", @{
@"event_id": eventId ?: @"unknown"
});
}
}
@@ -224,7 +224,7 @@ extension ContactsPickerViewModel: ContactsTableViewControllerDelegate {
case .success:
self.coordinatorDelegate?.contactsPickerViewModelDidEndInvite(self)
case .failure:
MXLog.error("[ContactsPickerViewModel] Failed to invite \(participantId) due to error; \(response.error ?? "nil")")
MXLog.error("[ContactsPickerViewModel] Failed to invite participant", context: response.error)
self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: response.error)
}
}
@@ -255,7 +255,7 @@ extension ContactsPickerViewModel: ContactsTableViewControllerDelegate {
case .success:
self.coordinatorDelegate?.contactsPickerViewModelDidEndInvite(self)
case .failure:
MXLog.error("[ContactsPickerViewModel] Failed to invite \(participantId) by email due to error; \(response.error ?? "nil")")
MXLog.error("[ContactsPickerViewModel] Failed to invite participant by email", context: response.error)
if let error = response.error as NSError?, error.domain == kMXRestClientErrorDomain, error.code == MXRestClientErrorMissingIdentityServer {
self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: nil)
@@ -273,7 +273,7 @@ extension ContactsPickerViewModel: ContactsTableViewControllerDelegate {
case .success:
self.coordinatorDelegate?.contactsPickerViewModelDidEndInvite(self)
case .failure:
MXLog.error("[ContactsPickerViewModel] Failed to invite \(participantId) due to error; \(response.error ?? "nil")")
MXLog.error("[ContactsPickerViewModel] Failed to invite participant", context: response.error)
self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: response.error)
}
}
+3 -1
View File
@@ -598,7 +598,9 @@ extension RoomCoordinator: RoomViewControllerDelegate {
func threadsCoordinator(for roomViewController: RoomViewController, threadId: String?) -> ThreadsCoordinatorBridgePresenter? {
guard let session = mxSession, let roomId = roomId else {
MXLog.error("[RoomCoordinator] Cannot create threads coordinator for room \(roomId ?? "")")
MXLog.error("[RoomCoordinator] Cannot create threads coordinator for room", context: [
"room_id": roomId
])
return nil
}
+6 -2
View File
@@ -67,7 +67,9 @@ extension RoomViewController {
case .success:
break
case .failure:
MXLog.error("[RoomViewController] sendAttributedTextMessage failed while updating event: \(eventModified.eventId ?? "N/A")")
MXLog.error("[RoomViewController] sendAttributedTextMessage failed while updating event", context: [
"event_id": eventModified.eventId
])
}
}
} else if self.inputToolbar?.sendMode == .edit, let eventModified = eventModified {
@@ -78,7 +80,9 @@ extension RoomViewController {
//
},
failure: { _ in
MXLog.error("[RoomViewController] sendAttributedTextMessage failed while updating event: \(eventModified.eventId ?? "N/A")")
MXLog.error("[RoomViewController] sendAttributedTextMessage failed while updating event", context: [
"event_id": eventModified.eventId
])
})
} else {
roomDataSource.sendAttributedTextMessage(attributedTextMsg) { response in
@@ -396,7 +396,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat
func mapViewDidFailLoadingMap(_ mapView: MGLMapView, withError error: Error) {
MXLog.error("[RoomTimelineLocationView] Failed to load map with error: \(error)")
MXLog.error("[RoomTimelineLocationView] Failed to load map", context: error)
self.isMapViewLoadingFailed = true
}
@@ -107,7 +107,7 @@ class VoiceMessageAttachmentCacheManager {
try setupTemporaryFilesFolder()
} catch {
completion(Result.failure(VoiceMessageAttachmentCacheManagerError.preparationError(error)))
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed creating temporary files folder with error: \(error)")
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed creating temporary files folder", context: error)
return
}
@@ -140,7 +140,7 @@ class VoiceMessageAttachmentCacheManager {
do {
try FileManager.default.removeItem(at: temporaryFilesFolderURL)
} catch {
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed clearing cached disk files with error: \(error)")
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed clearing cached disk files", context: error)
}
}
@@ -176,7 +176,7 @@ class VoiceMessageAttachmentCacheManager {
}, failure: { error in
// A nil error in this case is a cancellation on the MXMediaLoader
if let error = error {
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed decrypting attachment with error: \(String(describing: error))")
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed decrypting attachment", context: error)
self.invokeFailureCallbacksForIdentifier(identifier, requiredNumberOfSamples: numberOfSamples, error: VoiceMessageAttachmentCacheManagerError.decryptionError(error))
}
semaphore.signal()
@@ -189,7 +189,7 @@ class VoiceMessageAttachmentCacheManager {
}, failure: { error in
// A nil error in this case is a cancellation on the MXMediaLoader
if let error = error {
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed preparing attachment with error: \(String(describing: error))")
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed preparing attachment", context: error)
self.invokeFailureCallbacksForIdentifier(identifier, requiredNumberOfSamples: numberOfSamples, error: VoiceMessageAttachmentCacheManagerError.preparationError(error))
}
semaphore.signal()
@@ -232,14 +232,14 @@ class VoiceMessageAttachmentCacheManager {
semaphore.signal()
}
case .failure(let error):
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed retrieving audio duration with error: \(error)")
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed retrieving audio duration", context: error)
self.invokeFailureCallbacksForIdentifier(identifier, requiredNumberOfSamples: numberOfSamples, error: VoiceMessageAttachmentCacheManagerError.durationError(error))
semaphore.signal()
}
}
}
case .failure(let error):
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed converting voice message with error: \(error)")
MXLog.error("[VoiceMessageAttachmentCacheManager] Failed converting voice message", context: error)
self.invokeFailureCallbacksForIdentifier(identifier, requiredNumberOfSamples: numberOfSamples, error: VoiceMessageAttachmentCacheManagerError.conversionError(error))
semaphore.signal()
}
@@ -308,7 +308,7 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate,
MXLog.error("[VoiceMessageController] Failed retrieving media duration")
}
case .failure(let error):
MXLog.error("[VoiceMessageController] Failed getting audio duration with: \(error)")
MXLog.error("[VoiceMessageController] Failed getting audio duration", context: error)
}
dispatchGroup.leave()
@@ -336,7 +336,7 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate,
case .success:
finalURL = destinationURL
case .failure(let error):
MXLog.error("Failed failed encoding audio message with: \(error)")
MXLog.error("Failed failed encoding audio message", context: error)
}
dispatchGroup.leave()
@@ -371,7 +371,7 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate,
do {
try FileManager.default.removeItem(at: url)
} catch {
MXLog.error(error)
MXLog.error("[VoiceMessageController] deleteRecordingAtURL:", context: error)
}
}
@@ -137,7 +137,7 @@ class VoiceMessagePlaybackController: VoiceMessageAudioPlayerDelegate, VoiceMess
func audioPlayer(_ audioPlayer: VoiceMessageAudioPlayer, didFailWithError error: Error) {
state = .error
MXLog.error("Failed playing voice message with error: \(error)")
MXLog.error("Failed playing voice message", context: error)
}
func audioPlayerDidFinishPlaying(_ audioPlayer: VoiceMessageAudioPlayer) {