|
|
@@ -163,19 +163,16 @@ public enum GRPCError {
|
|
|
/// Too many, or too few, messages were sent over the given stream.
|
|
|
public struct StreamCardinalityViolation: GRPCErrorProtocol {
|
|
|
/// The stream on which there was a cardinality violation.
|
|
|
- public var stream: GRPCStreamType
|
|
|
+ public let description: String
|
|
|
|
|
|
- public init(stream: GRPCStreamType) {
|
|
|
- self.stream = stream
|
|
|
- }
|
|
|
+ /// A request stream cardinality violation.
|
|
|
+ public static let request = StreamCardinalityViolation("Request stream cardinality violation")
|
|
|
|
|
|
- public var description: String {
|
|
|
- switch self.stream {
|
|
|
- case .request:
|
|
|
- return "Request stream cardinality violation"
|
|
|
- case .response:
|
|
|
- return "Response stream cardinality violation"
|
|
|
- }
|
|
|
+ /// A response stream cardinality violation.
|
|
|
+ public static let response = StreamCardinalityViolation("Response stream cardinality violation")
|
|
|
+
|
|
|
+ private init(_ description: String) {
|
|
|
+ self.description = description
|
|
|
}
|
|
|
|
|
|
public func makeGRPCStatus() -> GRPCStatus {
|
|
|
@@ -297,13 +294,6 @@ extension GRPCErrorProtocol {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/// The type of stream. Messages are sent from the client to the server on the request stream, and
|
|
|
-/// from the server to the client on the response stream.
|
|
|
-public enum GRPCStreamType {
|
|
|
- case request
|
|
|
- case response
|
|
|
-}
|
|
|
-
|
|
|
extension GRPCStatus.Code {
|
|
|
/// The gRPC status code associated with the given HTTP status code. This should only be used if
|
|
|
/// the RPC did not return a 'grpc-status' trailer.
|