Convert functions to async/await
This commit is contained in:
18
Sources/App/Extensions/Optional+Extensions.swift
Normal file
18
Sources/App/Extensions/Optional+Extensions.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by CH on 12.10.22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Optional {
|
||||
|
||||
func unwrap(or error: @autoclosure () -> Error) throws -> Wrapped {
|
||||
guard let unwrapped = self else {
|
||||
throw error()
|
||||
}
|
||||
return unwrapped
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user