mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Don't crash when the tone manager directories can't be created
NotificationToneManager.init force-crashed (fatalError) when createDirectory failed, e.g. a sandbox permission error (NSCocoaError 513). Log the error instead of killing the app. The underlying cause is acknowledged and will be treated separately.
This commit is contained in:
@@ -54,7 +54,10 @@ nonisolated struct NotificationToneManager: NotificationToneManagerProtocol {
|
||||
try FileManager.default.createDirectory(at: NotificationToneManager.libraryLocation, withIntermediateDirectories: true)
|
||||
try FileManager.default.createDirectory(at: Self.selectedToneLocation.deletingLastPathComponent(), withIntermediateDirectories: true)
|
||||
} catch {
|
||||
fatalError("Catastrophic error setting up tone manager: \(error)")
|
||||
// Don't crash on a recoverable file system error. The underlying problem (directory creation
|
||||
// failing on launch, e.g. a background launch before the container is writable) is acknowledged
|
||||
// and will be treated separately.
|
||||
MXLog.error("Failed setting up tone manager directories: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user