refactor(errors): adopt reportable error terminology
This commit is contained in:
1 parent
21e9497915
commit
9fec2fa095
92 files changed
+270
-269
No files matched your search
@@ -10,5 +10,5 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
kaptan-config = { path = "../kaptan-config" }
|
||||
kaptan-err-propagate = { path = "../kaptan-err-propagate" }
|
||||
kaptan-err-reportable = { path = "../kaptan-err-reportable" }
|
||||
kaptan-mavlink = { path = "../kaptan-mavlink", default-features = false, features = ["dialect-kaptan"] }
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stable typed outcomes for the Kaptan configuration microservice.
|
||||
|
||||
use kaptan_config::{ConfigState, ConfigViolation, FieldId};
|
||||
use kaptan_err_propagate::KaptanError;
|
||||
use kaptan_err_reportable::KaptanError;
|
||||
|
||||
/// Operation reported in an authoritative result record.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
|
||||
@@ -23,7 +23,7 @@ pub(super) struct Session {
|
||||
pub(super) revision: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, kaptan_err_propagate::KaptanError)]
|
||||
#[derive(Debug, kaptan_err_reportable::KaptanError)]
|
||||
enum CommitTransactionError<E> {
|
||||
#[kaptan_error(id = 2201)]
|
||||
Store(E),
|
||||
@@ -337,9 +337,9 @@ impl ConfigProtocol {
|
||||
|
||||
/// Classifies expected configuration rejection separately from a terminal
|
||||
/// persistence failure. Only the latter leaves this boundary and becomes
|
||||
/// a typed firmware error; the configuration result remains authoritative
|
||||
/// a reportable firmware error; the configuration result remains authoritative
|
||||
/// for the requesting user.
|
||||
#[kaptan_err_propagate::propagate]
|
||||
#[kaptan_err_reportable::propagate]
|
||||
fn commit_transaction<C, S>(
|
||||
&mut self,
|
||||
manager: &mut ConfigManager<C, S>,
|
||||
@@ -1235,7 +1235,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn failed_commit_reports_the_returned_error_only_once() {
|
||||
while kaptan_err_propagate::take().is_some() {}
|
||||
while kaptan_err_reportable::take().is_some() {}
|
||||
let persists = Rc::new(Cell::new(0));
|
||||
let store = FailingStore(Rc::clone(&persists));
|
||||
let mut manager = ConfigManager::new(Candidate(2), (), store).unwrap();
|
||||
@@ -1277,9 +1277,9 @@ mod tests {
|
||||
Some(ProtocolError::StorageFailure)
|
||||
);
|
||||
let error =
|
||||
kaptan_err_propagate::take().expect("failed commit must report its returned error");
|
||||
kaptan_err_reportable::take().expect("failed commit must report its returned error");
|
||||
assert_eq!(error.id(), 2201);
|
||||
while kaptan_err_propagate::take().is_some() {}
|
||||
while kaptan_err_reportable::take().is_some() {}
|
||||
|
||||
protocol
|
||||
.dispatch(&mut manager, Authorized::host(7, commit), |_| {
|
||||
@@ -1288,7 +1288,7 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(persists.get(), 1);
|
||||
assert!(
|
||||
kaptan_err_propagate::take().is_none(),
|
||||
kaptan_err_reportable::take().is_none(),
|
||||
"a cached command replay must not report the error again"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use kaptan_config::{
|
||||
ConfigState, ConfigValue, FieldDescriptor, FieldId, ValidationRule, ValueKind,
|
||||
};
|
||||
use kaptan_err_propagate::KaptanError;
|
||||
use kaptan_err_reportable::KaptanError;
|
||||
use kaptan_mavlink::message::Message;
|
||||
use kaptan_mavlink::message::kaptan::{
|
||||
KAPTAN_CONFIG_DESCRIPTOR_DATA, KAPTAN_CONFIG_ENUM_OPTION_DATA, KAPTAN_CONFIG_INFO_DATA,
|
||||
|
||||
Reference in new issue
Block a user