We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1504344 commit af77755Copy full SHA for af77755
Sources/AlphaSwiftage/Public/AlphaVantageError.swift
@@ -7,10 +7,21 @@
7
8
import Foundation
9
10
-public enum AlphaVantageError: Error {
+public enum AlphaVantageError: Error, LocalizedError {
11
case apiError(AlphaVantageAPIError)
12
case unexpectedResponse(String)
13
case unknown(Error)
14
+
15
+ public var errorDescription: String? {
16
+ switch self {
17
+ case .apiError(let apiError):
18
+ return apiError.errorDescription
19
+ case .unexpectedResponse(let response):
20
+ return response
21
+ case .unknown(let error):
22
+ return error.localizedDescription
23
+ }
24
25
}
26
27
public struct AlphaVantageAPIError: Codable, LocalizedError, Equatable {
0 commit comments