AnalyticsNetworkError.swift
1.09 KB
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
//
// NetworkError.swift
// VPNAnalytics
//
// Created by Mihail Konoplitskyi on 20.03.2023.
//
import Foundation
public enum AnalyticsNetworkError: Error {
case errorSerializationJson
case errorParsingJson
case networkIsUnavailable
case serverIsUnavailable
case technicalErrorOnClientSide
case requestTimedOut
case unknown
case tokenIsDead
}
extension AnalyticsNetworkError: LocalizedError {
public var errorDescription: String? {
switch self {
case .technicalErrorOnClientSide:
return "technical_error_on_client_side"
case .errorParsingJson:
return "error_parsing_json"
case .errorSerializationJson:
return "error_serialization_json"
case .networkIsUnavailable:
return "network_is_unavailable"
case .serverIsUnavailable:
return "server_is_unavailable"
case .requestTimedOut:
return "request_timed_out"
case .tokenIsDead:
return "token_is_dead"
case .unknown:
return "unknown_error"
}
}
}