Skip to content

nativedevbr/swift-error-reporting

Repository files navigation

ErrorReporting

A description of this package. TBD.

Examples

SentrySDK integration

extension ErrorReporting.Destination {
  static let sentry = ErrorReporting.Destination { report in 
    SentrySDK.capture(error: report.nsError())
  }
}

Crashlytics integration

extension ErrorReporting.Destination {
  static let crashlytics = ErrorReporting.Destination { report in 
    Crashlytics.crashlytics().record(error: report.nsError())
  }
}

Usage

ErrorReporting.main = ErrorReporting(destinations: [.console, .sentry, .crashlytics])
ErrorReporting.main.report(MyCustomError())