use serde::Deserialize;
use serde::Serialize;
use ts_rs::TS;
use super::SourceLocation;
use super::event::EventSeq;
use super::event::TimeoutValue;
use super::span::SpanId;
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[cfg_attr(
feature = "ts-export",
ts(export, export_to = "../../../viewer/src/types/")
)]
pub struct StackFrame {
pub span: SpanId,
pub kind: String,
pub name: Option<String>,
pub args: Vec<(String, String)>,
pub alias: Option<String>,
pub location: Option<SourceLocation>,
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[cfg_attr(
feature = "ts-export",
ts(export, export_to = "../../../viewer/src/types/")
)]
#[serde(tag = "type", rename_all = "kebab-case")]
pub enum FailureRecord {
MatchTimeout {
span: SpanId,
event_seq: EventSeq,
shell: String,
pattern: String,
effective: TimeoutValue,
call_stack: Vec<StackFrame>,
buffer_tail: String,
vars_in_scope: Vec<(String, String)>,
},
FailPatternMatched {
span: SpanId,
event_seq: EventSeq,
shell: String,
pattern: String,
matched_line: String,
call_stack: Vec<StackFrame>,
buffer_tail: String,
vars_in_scope: Vec<(String, String)>,
},
ShellExited {
span: SpanId,
event_seq: EventSeq,
shell: String,
exit_code: Option<i32>,
call_stack: Vec<StackFrame>,
buffer_tail: String,
vars_in_scope: Vec<(String, String)>,
},
Runtime {
span: Option<SpanId>,
event_seq: Option<EventSeq>,
shell: Option<String>,
message: String,
call_stack: Vec<StackFrame>,
vars_in_scope: Vec<(String, String)>,
},
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[cfg_attr(
feature = "ts-export",
ts(export, export_to = "../../../viewer/src/types/")
)]
pub struct CancellationRecord {
pub reason: super::event::CancelReasonRecord,
pub span: Option<SpanId>,
pub event_seq: Option<EventSeq>,
pub shell: Option<String>,
pub call_stack: Vec<StackFrame>,
}