feat(diagnostics): preserve Registry and resource fault context for PLN-0176 step 28

This commit is contained in:
2026-10-07 21:13:59 +01:00
parent 74c7522dd1
commit 63e371955a
24 changed files with 1085 additions and 85 deletions
@@ -1,6 +1,7 @@
use prometeu_bytecode::TrapInfo;
use prometeu_vm::VmInitError;
use std::fmt;
mod init_diagnostic;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CrashReport {
@@ -10,6 +11,20 @@ pub enum CrashReport {
}
impl CrashReport {
/// The same machine fields serve headless and desktop transports.
pub fn init_diagnostic(&self) -> Option<serde_json::Value> {
match self {
Self::VmInit { error } => Some(init_diagnostic::serialize(error)),
_ => None,
}
}
pub fn resource_failure(&self) -> Option<prometeu_bytecode::ResourceFailure> {
match self {
Self::VmTrap { trap } => trap.resource,
Self::VmInit { error: VmInitError::RuntimeResourceLimit(resource) } => Some(*resource),
_ => None,
}
}
pub fn kind(&self) -> &'static str {
match self {
Self::VmTrap { .. } => "vm_trap",