cc_lb_plugin_conformance/
errors.rs1use thiserror::Error;
2
3use cc_lb_plugin_wire::wire_function::FallbackPolicy;
4
5use crate::{handshake, identity, self_check};
6
7#[non_exhaustive]
8#[derive(Debug, Error)]
9pub enum VerifyError {
10 #[error("identity verification failed: {0}")]
11 Identity(#[from] identity::IdentityError),
12 #[error("handshake verification failed: {0}")]
13 Handshake(#[from] handshake::HandshakeError),
14 #[error("self-check verification failed: {0}")]
15 SelfCheck(#[from] self_check::SelfCheckError),
16 #[error("dispatch verification failed: {0}")]
17 Dispatch(#[from] DispatchError),
18}
19
20#[non_exhaustive]
21#[derive(Debug, Clone)]
22pub struct VerifyReport {
23 pub identity: LayerResult,
24 pub handshake: LayerResult,
25 pub self_check: LayerResult,
26 pub dispatch: Vec<LayerResult>,
27 pub extras: Vec<ExtraInfo>,
28}
29
30#[non_exhaustive]
31#[derive(Debug, Clone)]
32pub struct LayerResult {
33 pub layer: &'static str,
34 pub passed: bool,
35 pub detail: Option<String>,
36}
37
38#[non_exhaustive]
39#[derive(Debug, Clone)]
40pub struct ExtraInfo {
41 pub kind: &'static str,
42 pub message: String,
43}
44
45#[doc(hidden)]
46#[non_exhaustive]
47#[derive(Debug, Clone, Error)]
48pub enum DispatchError {
49 #[error("{function} dispatch fell back with policy {policy:?}")]
50 Fallback {
51 function: &'static str,
52 policy: FallbackPolicy,
53 },
54 #[error("{function} response failed conformance check: {reason}")]
55 InvalidResponse {
56 function: &'static str,
57 reason: String,
58 },
59}