mirror of
https://github.com/hyperoslo/Cache.git
synced 2026-04-07 19:17:36 +00:00
12 lines
190 B
Swift
12 lines
190 B
Swift
import Foundation
|
|
|
|
public extension Optional {
|
|
func unwrapOrThrow(error: Error) throws -> Wrapped {
|
|
if let value = self {
|
|
return value
|
|
} else {
|
|
throw error
|
|
}
|
|
}
|
|
}
|