ErrorWrapping Protocol Reference
public protocol ErrorWrapping<SomeError> : Error
An error that can be created with an underlying error of a specific type.
-
The type of error that this
ErrorWrappingcan wrap.Declaration
Swift
associatedtype SomeError : Error -
Creates an
ErrorWrappingerror with the given underlying error. Usually this can be a case in an error enum.Declaration
Swift
static func underlyingError(_ error: SomeError) -> Self -
wrapErrors(block:Extension method) Wraps the eventual errors thrown by the given block.
Throws
AnErrorWrappingthat wraps the underlying error.Declaration
Swift
static func wrapErrors<T>(block: () throws(SomeError) -> T) throws(Self) -> TParameter Description blockThe throwing block that can throw
SomeError, which will be wrapped into anErrorWrapping.