systemprompt_models/api/errors/
config_plane.rs1use systemprompt_provider_contracts::ConfigPlaneError;
12
13use super::ApiError;
14
15const PLANE_FAILURE: &str = "Config plane operation failed";
16
17impl From<ConfigPlaneError> for ApiError {
18 fn from(err: ConfigPlaneError) -> Self {
19 match err {
20 ConfigPlaneError::FileManaged { .. } => {
21 Self::conflict(err.to_string()).with_error_key("config_plane_file_managed")
22 },
23 ConfigPlaneError::UnknownPlane(_) => Self::not_found(err.to_string()),
24 ConfigPlaneError::Invalid { .. } | ConfigPlaneError::Unsupported { .. } => {
25 Self::bad_request(err.to_string())
26 },
27 other => Self::internal(PLANE_FAILURE, other),
28 }
29 }
30}