mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-04 11:05:56 +00:00
smlib: a call answers None exactly when solidcore's error stands for an SMLib status (SolidError::sm_status, solidcore#1452)
Same set as before (Upstream and Nlib), now read from solidcore's own classification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MNXLXkZLQ6T7TSi4wswcmk
This commit is contained in:
@@ -176,15 +176,15 @@ pub(crate) fn run<T>(call: &'static str, f: impl FnOnce(&mut Kernel) -> std::res
|
||||
}
|
||||
}
|
||||
|
||||
/// A call the capi checks for `SM_SUCCESS`, treating any other status as no answer: an SMLib
|
||||
/// status (solidcore's [`SolidError::Upstream`](solidcore::SolidError::Upstream), or NLib's
|
||||
/// [`SolidError::Nlib`](solidcore::SolidError::Nlib)) is `None`. Every other solidcore error
|
||||
/// A call the capi checks for `SM_SUCCESS`, treating any other status as no answer: an error
|
||||
/// that stands for an SMLib status exactly ([`SolidError::sm_status`](solidcore::SolidError::sm_status),
|
||||
/// solidcore#1452) is `None`. Every other solidcore error
|
||||
/// (unported code, invalid input to an adapter, a missing record...) is not a status the C++
|
||||
/// path returns, so it fails the call instead of hiding as a skipped entity.
|
||||
pub(crate) fn answer<T>(r: std::result::Result<T, solidcore::SolidError>) -> std::result::Result<Option<T>, solidcore::SolidError> {
|
||||
match r {
|
||||
Ok(v) => Ok(Some(v)),
|
||||
Err(solidcore::SolidError::Upstream { .. } | solidcore::SolidError::Nlib { .. }) => Ok(None),
|
||||
Err(e) if e.sm_status().is_some() => Ok(None),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user