synapse_application/
diagnostic.rs1use serde::Deserialize;
2use soma_ops::{DiagnosticCode, DiagnosticSeverity, RetryClass};
3
4#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
6pub struct DiagnosticProjection {
7 code: DiagnosticCode,
8 category: String,
9 cli_exit_code: u8,
10 http_status: u16,
11 mcp_error_code: i32,
12 event_severity: DiagnosticSeverity,
13 retry: RetryClass,
14 terminal: bool,
15}
16
17impl DiagnosticProjection {
18 #[must_use]
20 pub fn code(&self) -> &DiagnosticCode {
21 &self.code
22 }
23 #[must_use]
25 pub fn category(&self) -> &str {
26 &self.category
27 }
28 #[must_use]
30 pub const fn cli_exit_code(&self) -> u8 {
31 self.cli_exit_code
32 }
33 #[must_use]
35 pub const fn http_status(&self) -> u16 {
36 self.http_status
37 }
38 #[must_use]
40 pub const fn mcp_error_code(&self) -> i32 {
41 self.mcp_error_code
42 }
43 #[must_use]
45 pub const fn event_severity(&self) -> DiagnosticSeverity {
46 self.event_severity
47 }
48 #[must_use]
50 pub const fn retry(&self) -> RetryClass {
51 self.retry
52 }
53 #[must_use]
55 pub const fn terminal(&self) -> bool {
56 self.terminal
57 }
58}
59
60#[cfg(test)]
61#[path = "diagnostic_tests.rs"]
62mod tests;