flagsmith_flag_engine/
error.rs1use std::fmt;
2
3#[derive(Debug)]
5pub struct Error {
6 pub kind: ErrorKind,
7}
8
9#[derive(Debug, PartialEq)]
11pub enum ErrorKind {
12 FeatureStateNotFound,
13 DuplicateFeatureState,
14}
15
16impl Error {
17 pub fn new(kind: ErrorKind) -> Error {
18 Error { kind }
19 }
20}
21impl fmt::Display for Error {
22 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
23 match self.kind {
24 ErrorKind::FeatureStateNotFound => write!(f, "Feature State Not Found"),
25 ErrorKind::DuplicateFeatureState => write!(f, "Feature State already exists"),
26 }
27 }
28}