updateOrionErrorHandler(_:)
public func updateOrionErrorHandler(
_ update: (_ previous: @escaping OrionErrorHandler) -> OrionErrorHandler
)
Updates the OrionErrorHandler which is called when Orion encounters
a non-recoverable error.
The default error handler is fatalError.
Important
You probably want to implement Tweak.handleError(_:) instead
of calling this method. Unlike the Tweak variant, this updates the global
error handler (i.e. for all tweaks), and once a failure bubbles up to this
method it must terminate the app. A valid use case for calling this method
is, for example, a crash reporter that wants to log errors before letting the
process crash.
Warning
This function is thread-safe but not reentrant. Do not call
updateOrionErrorHandler(_:) or orionError(_:file:line:) inside the
update block or the returned error handler.
Example
updateOrionErrorHandler { old in
return { message, file, line in
let str = message()
// save (str, file, line) to a file
old(str, file, line)
}
}
Parameters
update
|
A closure which is passed the previous error handler and returns an updated handler. |
previous
|
The previous error handler. You may want to call this at the end of your error handler closure. |
View on GitHub
Install in Dash
updateOrionErrorHandler(_:) Function Reference