mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			42 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Swift
		
	
|   
											1 year ago
										 | // 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() | ||
|  |         } | ||
|  |     } | ||
|  | } |