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.

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()
        // do something with str, file, line
        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.