Skip to content

Commit eebb31b

Browse files
committed
feat: attempt to log uncaught objective-c exceptions
Signed-off-by: Tommy van der Vorst <tommy@pixelspark.nl>
1 parent 2fdad21 commit eebb31b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sushitrain/App.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ struct SushitrainApp: App {
3030
#endif
3131

3232
init() {
33+
// Install uncaught exception handler
34+
NSSetUncaughtExceptionHandler { e in
35+
Log.warn("Uncaught exception: \(e.name) reason=\(e.reason ?? "unknown") returnAddress=\(e.callStackReturnAddresses) symbols=\(e.callStackSymbols)")
36+
}
37+
38+
// Find out all the relevant locations we need to access
3339
let configDirectory = Self.configDirectoryURL()
34-
3540
let documentsDirectory = try! FileManager.default.url(
3641
for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
3742
let documentsPath = documentsDirectory.path(percentEncoded: false)

0 commit comments

Comments
 (0)