synapse_application/
error.rs1use soma_ops::{DiagnosticCode, OperationName};
2
3#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
5#[non_exhaustive]
6pub enum CompatibilityError {
7 #[error("embedded contract {artifact} is invalid: {message}")]
9 EmbeddedContract {
10 artifact: &'static str,
12 message: String,
14 },
15 #[error("unknown canonical operation: {0}")]
17 UnknownOperation(OperationName),
18 #[error("unknown legacy operation: tool={tool}, action={action}, subaction={subaction:?}")]
20 UnknownLegacyOperation {
21 tool: &'static str,
23 action: String,
25 subaction: Option<String>,
27 },
28 #[error("invalid legacy request field {field}: {message}")]
30 InvalidLegacyRequest {
31 field: String,
33 message: String,
35 },
36 #[error("unknown field {field} for operation {operation}")]
38 UnknownField {
39 operation: OperationName,
41 field: String,
43 },
44 #[error("{kind} schema validation failed for {operation}: {details}")]
46 SchemaValidation {
47 operation: OperationName,
49 kind: &'static str,
51 details: String,
53 },
54 #[error("legacy request has conflicting format and response_format values")]
56 ConflictingPresentation,
57 #[error("unsupported legacy presentation format: {0}")]
59 InvalidPresentation(String),
60 #[error("unknown diagnostic projection: {0}")]
62 UnknownDiagnostic(DiagnosticCode),
63 #[error("diagnostic {code} is not declared by operation {operation}")]
65 DiagnosticNotDeclared {
66 operation: OperationName,
68 code: DiagnosticCode,
70 },
71}
72
73#[cfg(test)]
74#[path = "error_tests.rs"]
75mod tests;