Skip to content

Commit

Permalink
Further improve Crashlytics error reporting
Browse files Browse the repository at this point in the history
Currently, this is all we get:

```
nserror-code	3
nserror-domain	Gifski.Gifski.Error
```

Where `code` is the underlying enum number, but it misses the actual description, which can contain important debug information.
  • Loading branch information
sindresorhus committed Mar 27, 2019
1 parent c853443 commit 05f79b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Gifski/AppDelegate.swift
Expand Up @@ -62,7 +62,13 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

func application(_ application: NSApplication, willPresentError error: Error) -> Error {
#if !DEBUG
Crashlytics.sharedInstance().recordError(error)
Crashlytics.sharedInstance().recordError(
// This forces Crashlytics to actually provide some useful info for Swift errors
error as NSError,
withAdditionalUserInfo: [
"type": "\(type(of: error)).\(error)",
"localizedDescription": error.localizedDescription
])
#endif

return error
Expand Down

0 comments on commit 05f79b4

Please sign in to comment.