forge_primitives/
error.rs1#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error, serde::Serialize, serde::Deserialize)]
5#[serde(rename_all = "snake_case")]
6pub enum AppError {
7 #[error("Agent bridge connection failed")]
8 ConnectionFailed,
9}
10
11impl AppError {
12 pub const CONNECTION_FAILED_EXIT_CODE: i32 = 22;
13
14 pub fn exit_code(&self) -> i32 {
15 match self {
16 Self::ConnectionFailed => Self::CONNECTION_FAILED_EXIT_CODE,
17 }
18 }
19
20 pub fn user_message(&self) -> &'static str {
21 match self {
22 Self::ConnectionFailed => {
23 "Failed to establish or maintain the Agent SDK bridge connection."
24 }
25 }
26 }
27}