-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathConnectionNetworkError.swift
54 lines (39 loc) · 1.62 KB
/
ConnectionNetworkError.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// ConnectionNetworkError.swift
// IFTTT SDK
//
// Copyright © 2019 IFTTT. All rights reserved.
//
import Foundation
/// An error occurred, preventing the network controller from completing network requests.
public enum NetworkControllerError: Error {
/// The total retry attempts were exhausted.
case exhaustedRetryAttempts
/// We got back some invalid response that can't be dealt with
case invalidResponse
/// Response parameters did not match what we expected. This should never happen. Verify that the latest SDK is being used.
case unknownResponse
/// The network request got cancelled. This could happen by nil'ing out a network request or by explicitly canceling a network request.
case cancelled
/// The network request resulted in a authentication error
case authenticationFailure
/// Could not decode image data.
case invalidImageData
/// Some generic networking error occurred
case genericError(Error)
}
/// An error occurred, preventing the network controller from completing `Connection` network requests.
public enum ConnectionNetworkError: Error {
/// Some generic networking error occurred
case genericError(Error)
/// Response parameters did not match what we expected. This should never happen. Verify you are using the latest SDK.
case unknownResponse
init(networkControllerError: NetworkControllerError) {
switch networkControllerError {
case .genericError(let error):
self = .genericError(error)
default:
self = .unknownResponse
}
}
}