clean errors

pull/1023/head
Ryan ZHAO 7 months ago
parent 8d05a9dce3
commit d31036f60c

@ -165,6 +165,7 @@
7BFD1A8A2745C4F000FB91B9 /* Permissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFD1A892745C4F000FB91B9 /* Permissions.swift */; };
7BFD1A972747689000FB91B9 /* Session-Turn-Server in Resources */ = {isa = PBXBuildFile; fileRef = 7BFD1A962747689000FB91B9 /* Session-Turn-Server */; };
9409433E2C7EB81800D9D2E0 /* WebRTCSession+Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9409433D2C7EB81800D9D2E0 /* WebRTCSession+Constants.swift */; };
940943402C7ED62300D9D2E0 /* StartupError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9409433F2C7ED62300D9D2E0 /* StartupError.swift */; };
942256802C23F8BB00C0FDBF /* StartConversationScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9422567D2C23F8BB00C0FDBF /* StartConversationScreen.swift */; };
942256812C23F8BB00C0FDBF /* NewMessageScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9422567E2C23F8BB00C0FDBF /* NewMessageScreen.swift */; };
942256822C23F8BB00C0FDBF /* InviteAFriendScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9422567F2C23F8BB00C0FDBF /* InviteAFriendScreen.swift */; };
@ -1357,6 +1358,7 @@
7BFD1A8B2747150E00FB91B9 /* TurnServerInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TurnServerInfo.swift; sourceTree = "<group>"; };
7BFD1A962747689000FB91B9 /* Session-Turn-Server */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Session-Turn-Server"; sourceTree = "<group>"; };
9409433D2C7EB81800D9D2E0 /* WebRTCSession+Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WebRTCSession+Constants.swift"; sourceTree = "<group>"; };
9409433F2C7ED62300D9D2E0 /* StartupError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartupError.swift; sourceTree = "<group>"; };
9422567D2C23F8BB00C0FDBF /* StartConversationScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StartConversationScreen.swift; sourceTree = "<group>"; };
9422567E2C23F8BB00C0FDBF /* NewMessageScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewMessageScreen.swift; sourceTree = "<group>"; };
9422567F2C23F8BB00C0FDBF /* InviteAFriendScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InviteAFriendScreen.swift; sourceTree = "<group>"; };
@ -3466,6 +3468,7 @@
isa = PBXGroup;
children = (
C3AAFFF125AE99710089E6DD /* AppDelegate.swift */,
9409433F2C7ED62300D9D2E0 /* StartupError.swift */,
34D99CE3217509C1000AFB39 /* AppEnvironment.swift */,
7BFD1A952747689000FB91B9 /* TurnServers */,
B8FF8E6025C10D8B004D1F22 /* Countries */,
@ -6246,6 +6249,7 @@
7B5233C42900E90F00F8F375 /* SessionLabelCarouselView.swift in Sources */,
7B93D07727CF1A8A00811CB6 /* MockDataGenerator.swift in Sources */,
7B1B52D828580C6D006069F2 /* EmojiPickerSheet.swift in Sources */,
940943402C7ED62300D9D2E0 /* StartupError.swift in Sources */,
FD368A6A29DE9E30000DBF1E /* UIContextualAction+Utilities.swift in Sources */,
FDEF57252C3CF04C00131302 /* WebRTCSession+DataChannel.swift in Sources */,
7BAFA1192A39669400B76CB9 /* BezierPathView.swift in Sources */,

@ -380,7 +380,6 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
return
}
let filePath = asset.filePath
let dataSource = DataSourcePath(filePath: asset.filePath, shouldDeleteOnDeinit: false)
let attachment = SignalAttachment.attachment(dataSource: dataSource, dataUTI: rendition.utiType, imageQuality: .medium)

@ -11,13 +11,11 @@ enum GiphyFormat {
case gif, mp4, jpg
}
enum GiphyError: Error {
enum GiphyError: Error, CustomStringConvertible {
case assertionError(description: String)
case fetchFailure
}
extension GiphyError: LocalizedError {
public var errorDescription: String? {
var description: String {
return "errorUnknown".localized()
}
}

@ -12,14 +12,12 @@ protocol PhotoCaptureViewControllerDelegate: AnyObject {
func photoCaptureViewControllerDidCancel(_ photoCaptureViewController: PhotoCaptureViewController)
}
enum PhotoCaptureError: Error {
enum PhotoCaptureError: Error, CustomStringConvertible {
case assertionError(description: String)
case initializationFailed
case captureFailed
}
extension PhotoCaptureError: LocalizedError {
var localizedDescription: String {
public var description: String {
return "cameraErrorUnavailable".localized()
}
}

@ -507,7 +507,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
exit(0)
})
Log.info("Showing startup alert due to error: \(error.name)")
Log.info("Showing startup alert due to error: \(error.description)")
self.window?.rootViewController?.present(alert, animated: animated, completion: presentationCompletion)
}
@ -923,39 +923,3 @@ private enum LifecycleMethod: Equatable {
}
}
}
// MARK: - StartupError
private enum StartupError: Error {
case databaseError(Error)
case failedToRestore
case startupTimeout
var name: String {
switch self {
case .databaseError(StorageError.startupFailed), .databaseError(DatabaseError.SQLITE_LOCKED):
return "Database startup failed" // stringlint:disable
case .databaseError(StorageError.migrationNoLongerSupported): return "Unsupported version" // stringlint:disable
case .failedToRestore: return "Failed to restore" // stringlint:disable
case .databaseError: return "Database error" // stringlint:disable
case .startupTimeout: return "Startup timeout" // stringlint:disable
}
}
var message: String {
switch self {
case .databaseError(StorageError.startupFailed), .databaseError(DatabaseError.SQLITE_LOCKED), .failedToRestore, .databaseError:
return "databaseErrorGeneric".localized()
case .databaseError(StorageError.migrationNoLongerSupported):
return "databaseErrorUpdate"
.put(key: "app_name", value: Constants.app_name)
.localized()
case .startupTimeout:
return "databaseErrorTimeout"
.put(key: "app_name", value: Constants.app_name)
.localized()
}
}
}

@ -0,0 +1,41 @@
// Copyright © 2024 Rangeproof Pty Ltd. All rights reserved.
//
// stringlint:disable
import Foundation
import GRDB
import SessionUtilitiesKit
internal enum StartupError: Error, CustomStringConvertible {
case databaseError(Error)
case failedToRestore
case startupTimeout
public var description: String {
switch self {
case .databaseError(StorageError.startupFailed), .databaseError(DatabaseError.SQLITE_LOCKED):
return "Database startup failed"
case .databaseError(StorageError.migrationNoLongerSupported): return "Unsupported version"
case .failedToRestore: return "Failed to restore"
case .databaseError: return "Database error"
case .startupTimeout: return "Startup timeout"
}
}
var message: String {
switch self {
case .databaseError(StorageError.startupFailed), .databaseError(DatabaseError.SQLITE_LOCKED), .failedToRestore, .databaseError:
return "databaseErrorGeneric".localized()
case .databaseError(StorageError.migrationNoLongerSupported):
return "databaseErrorUpdate"
.put(key: "app_name", value: Constants.app_name)
.localized()
case .startupTimeout:
return "databaseErrorTimeout"
.put(key: "app_name", value: Constants.app_name)
.localized()
}
}
}
Loading…
Cancel
Save