|
14 | 14 |
|
15 | 15 | import protocol Foundation.LocalizedError
|
16 | 16 |
|
17 |
| -/// When working with RedisNIO, several errors are thrown to indicate problems |
18 |
| -/// with state, assertions, or otherwise. |
19 |
| -public enum RedisNIOError: LocalizedError { |
| 17 | +/// When working with `RedisClient`, runtime errors can be thrown to indicate problems with connection state, decoding assertions, or otherwise. |
| 18 | +public enum RedisClientError: LocalizedError { |
| 19 | + /// The connection is closed, but was used to try and send a command to Redis. |
20 | 20 | case connectionClosed
|
21 |
| - case responseConversion(to: Any.Type) |
22 |
| - case unsupportedOperation(method: StaticString, message: String) |
| 21 | + /// Conversion from `RESPValue` to the specified type failed. |
| 22 | + /// If this is ever triggered, please capture the original `RESPValue` value. |
| 23 | + case failedRESPConversion(to: Any.Type) |
| 24 | + /// Expectations of message structures were not met. |
| 25 | + /// If this is ever triggered, please capture the original byte message from Redis along with the command and arguments to Redis. |
23 | 26 | case assertionFailure(message: String)
|
24 | 27 |
|
25 | 28 | public var errorDescription: String? {
|
26 | 29 | let message: String
|
27 | 30 | switch self {
|
28 | 31 | case .connectionClosed: message = "Connection was closed while trying to send command."
|
29 |
| - case let .responseConversion(type): message = "Failed to convert RESP to \(type)" |
30 |
| - case let .unsupportedOperation(method, helpText): message = "\(method) - \(helpText)" |
| 32 | + case let .failedRESPConversion(type): message = "Failed to convert RESP to \(type)" |
31 | 33 | case let .assertionFailure(text): message = text
|
32 | 34 | }
|
33 | 35 | return "RedisNIO: \(message)"
|
34 | 36 | }
|
35 | 37 | }
|
36 | 38 |
|
37 |
| -/// When sending commands to a Redis server, errors caught will be returned as an error message. |
38 |
| -/// These messages are represented by `RedisError` instances. |
| 39 | +/// If something goes wrong with a command within Redis, it will respond with an error that is captured and represented by instances of this type. |
39 | 40 | public struct RedisError: LocalizedError {
|
40 | 41 | public let message: String
|
41 | 42 |
|
|
0 commit comments