fix: align protocol error semantics
This commit is contained in:
@@ -235,6 +235,10 @@ impl ObjectProvider for TestProvider {
|
||||
)
|
||||
}
|
||||
"/empty" => (Document::open("empty", None, Rc::clone(&self.calls)), 0),
|
||||
"/invalid-object" => (
|
||||
Document::open("wrong-name", None, Rc::clone(&self.calls)),
|
||||
0,
|
||||
),
|
||||
"/broken" => (
|
||||
Document::open("broken", Some("broken-ref"), Rc::clone(&self.calls)),
|
||||
3,
|
||||
@@ -624,9 +628,15 @@ fn immutable_interface_rejects_a_supplied_validator() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_results_and_backend_failures_keep_distinct_protocol_codes() {
|
||||
fn invalid_host_responses_and_uncertain_operation_failures_use_canonical_codes() {
|
||||
let (_, provider, _) = registry_and_provider();
|
||||
|
||||
assert_failure(
|
||||
provider.fetch("/invalid-object").unwrap_err(),
|
||||
CallErrorKind::Internal,
|
||||
ProtocolErrorCode::Internal,
|
||||
);
|
||||
|
||||
assert_failure(
|
||||
provider
|
||||
.call_operation(request(
|
||||
@@ -639,7 +649,7 @@ fn invalid_results_and_backend_failures_keep_distinct_protocol_codes() {
|
||||
))
|
||||
.unwrap_err(),
|
||||
CallErrorKind::InvalidResult,
|
||||
ProtocolErrorCode::InvalidResult,
|
||||
ProtocolErrorCode::OperationOutcomeUnknown,
|
||||
);
|
||||
assert_failure(
|
||||
provider
|
||||
@@ -653,6 +663,6 @@ fn invalid_results_and_backend_failures_keep_distinct_protocol_codes() {
|
||||
))
|
||||
.unwrap_err(),
|
||||
CallErrorKind::Implementation,
|
||||
ProtocolErrorCode::Internal,
|
||||
ProtocolErrorCode::OperationOutcomeUnknown,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user