1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Typed errors for Merry core protocol validation.
use thiserror::Error;
/// Errors raised while constructing or decoding core protocol types.
#[derive(Debug, Clone, PartialEq, Eq, Error)]
pub enum CoreError {
/// A typed identifier or protocol name failed validation.
#[error("invalid identifier/name: {kind} {reason} (value: {value:?})")]
InvalidIdentifier {
/// The identifier type being validated.
kind: &'static str,
/// The invalid value.
value: String,
/// Actionable validation detail.
reason: &'static str,
},
/// A provider-neutral schema failed validation.
#[error("invalid schema for {kind}: {reason}")]
InvalidSchema {
/// The schema wrapper being validated.
kind: &'static str,
/// Actionable validation detail.
reason: &'static str,
},
/// A tool specification failed validation.
#[error("invalid tool spec: {reason}")]
InvalidToolSpec {
/// Actionable validation detail.
reason: &'static str,
},
/// A pending tool call failed validation.
#[error("invalid tool call: {reason}")]
InvalidToolCall {
/// Actionable validation detail.
reason: &'static str,
},
/// A tool call result failed validation.
#[error("invalid tool call result: {reason}")]
InvalidToolCallResult {
/// Actionable validation detail.
reason: &'static str,
},
}