3 struct CuttlefishErrorMatcher {
4 let code: CuttlefishErrorCode
7 // Use a 'pattern match operator' to make pretty case statements matching Cuttlefish errors
8 func ~= (pattern: CuttlefishErrorMatcher, value: Error?) -> Bool {
9 guard let error = value else {
12 let nserror = error as NSError
13 return nserror.isCuttlefishError(pattern.code)
16 func CuttlefishRetryAfter(error: Error?) -> TimeInterval {
17 guard let error = error else {
20 let nserror = error as NSError
21 return nserror.cuttlefishRetryAfter()