diff --git a/ConversationsClassic/AppCore/Files/FileProcessing.swift b/ConversationsClassic/AppCore/Files/FileProcessing.swift index 226ac60..582682f 100644 --- a/ConversationsClassic/AppCore/Files/FileProcessing.swift +++ b/ConversationsClassic/AppCore/Files/FileProcessing.swift @@ -28,14 +28,24 @@ final class FileProcessing { // create thumbnail if not exists switch localName.attachmentType { case .image: - guard let image = UIImage(contentsOfFile: localUrl.path) else { return nil } + guard let image = UIImage(contentsOfFile: localUrl.path) else { + print("FileProcessing: Error loading image: \(localUrl)") + return nil + } let targetSize = CGSize(width: Const.attachmentPreviewSize, height: Const.attachmentPreviewSize) - guard let thumbnail = scaleAndCropImage(image, targetSize) else { return nil } - guard let data = thumbnail.pngData() else { return nil } + guard let thumbnail = scaleAndCropImage(image, targetSize) else { + print("FileProcessing: Error scaling image: \(localUrl)") + return nil + } + guard let data = thumbnail.pngData() else { + print("FileProcessing: Error converting thumbnail of \(localUrl) to data") + return nil + } do { try data.write(to: thumbnailUrl) return thumbnailFileName } catch { + print("FileProcessing: Error writing thumbnail: \(error)") return nil }