dpp_plugin_traits/
error.rs1use serde::{Deserialize, Serialize};
4use thiserror::Error;
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct PluginFieldError {
10 pub field: String,
12 pub code: String,
14 pub message: String,
16}
17
18#[derive(Debug, Clone, Error, Serialize, Deserialize)]
19#[non_exhaustive]
20pub enum PluginError {
21 #[error("invalid input: {0}")]
22 InvalidInput(String),
23 #[error("validation errors: {0:?}")]
24 ValidationErrors(Vec<PluginFieldError>),
25 #[error("calculation failed: {0}")]
26 Calculation(String),
27 #[error("product_group not supported by this plugin: {0}")]
28 UnsupportedProductGroup(String),
29 #[error("schema version not supported: {0}")]
30 UnsupportedSchemaVersion(String),
31 #[error("capability not available: {0}")]
32 CapabilityNotAvailable(String),
33 #[error("internal plugin error: {0}")]
34 Internal(String),
35}