Instance Methodvapor 4.114.1Vapor->NIOCore
unwrap(or:)
Unwraps an Optional value contained inside a Future’s expectation. If the optional resolves to nil (.none), the supplied error will be thrown instead.
func unwrap(or error: @autoclosure @escaping () -> Error) -> EventLoopFuture<Value.WrappedType> Parameters
- error
Errorto throw if the value isnil. This is captured with@autoclosureto avoid initialize theErrorunless needed.
print(futureString) // Future<String?>
futureString.unwrap(or: MyError()) // Future<String>