Skip to main content

Module error_model

Module error_model 

Source
Expand description

Fail-closed error taxonomy and mutex policy.

§Error model (engineering rules)

Panic is a runtime bug, not an error-handling mechanism.

§Taxonomy

KindExampleSurface
A — user / APIspawn bad function indexResult<T, SpawnError>
B — flownative fault, bad Atomic HopFlowOutcome::Failed → Supervisor
C — infrastructuremutex poisonRuntimeError + fail-closed (report_fault)
D — invariantempty VM frame stacktypes / debug_assert — never unwrap to hide design

§Mutex policy

Never:

lock.lock().unwrap()
lock.lock().unwrap_or_else(|e| e.into_inner())

Use sync_lock::lockResult<_, RuntimeError::PoisonedLock>. In worker loops: report_fault + return. At API boundaries: propagate Result.

§Clippy (core crate)

unwrap_used = "deny"
expect_used = "deny"

Tests are allowed unwrap/expect via cfg_attr(test, allow(...)) on the lib crate.

§Host API (category A)

let rt = Runtime::new(chunk)?;                         // SpawnError::VerifyFailed | ThreadSpawnFailed
let handle = rt.spawn(fn_idx, &args)?;                 // SpawnError::BadFunction | …
let sup = Supervisor::new(rt.spawner())?;
let child = sup.start_child(spec)?;

Never panic on bad function index, failed verify, or OS thread spawn failure.