MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / rejection_from_error_info

Function rejection_from_error_info

libatomic/src/daemon/sandbox_wire.rs:294–311  ·  view source on GitHub ↗

The [`SubmitRejection`] an [`pb::ErrorInfo`] from [`rejection_error_info`] describes, if it is one.

(info: &pb::ErrorInfo)

Source from the content-addressed store, hash-verified

292/// The [`SubmitRejection`] an [`pb::ErrorInfo`] from
293/// [`rejection_error_info`] describes, if it is one.
294pub fn rejection_from_error_info(info: &pb::ErrorInfo) -> Option<SubmitRejection> {
295 let get = |k: &str| info.context.get(k).cloned();
296 Some(match info.context.get(REJECTION_REASON)?.as_str() {
297 "hash_mismatch" => SubmitRejection::HashMismatch {
298 claimed: get("claimed")?,
299 computed: get("computed")?,
300 },
301 "malformed" => SubmitRejection::Malformed(get("detail")?),
302 "stale_view" => SubmitRejection::StaleView {
303 current: get("current")?,
304 },
305 "foreign_change" => SubmitRejection::ForeignChange(get("change")?),
306 "foreign_node" => SubmitRejection::ForeignNode(get("node")?.parse().ok()?),
307 "forbidden_path" => SubmitRejection::ForbiddenPath(get("path")?),
308 "already_present" => SubmitRejection::AlreadyPresent(get("change")?),
309 _ => return None,
310 })
311}
312
313/// Envelope hint only. Core decoding still authenticates CODECS and the hash.
314/// Historical payloads keep the legacy label; they are never upgraded here.

Callers 7

submitMethod · 0.85
publish_provenanceMethod · 0.85
submit_attestationMethod · 0.85
submitMethod · 0.85
publish_provenanceMethod · 0.85
submit_attestationMethod · 0.85

Calls 5

getMethod · 0.65
getFunction · 0.50
as_strMethod · 0.45
okMethod · 0.45
parseMethod · 0.45