Public repository: timo / feel

Reader

An interpreter of FEEL, written in Rust, with integrations for PostgreSQL, WASM, Lua, and Python.

Outline: 2 definitions
1
//! Error type for the engine.
2
3
use std::fmt;
4
5
/// Anything that can go wrong while evaluating a FEEL expression.
6
#[derive(Debug, Clone, PartialEq)]
7
pub enum FeelError {
8
    /// The expression could not be parsed by the grammar.
9
    Parse(String),
10
    /// The expression parsed but could not be evaluated (e.g. type mismatch).
11
    Eval(String),
12
}
13
14
impl fmt::Display for FeelError {
15
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16
        match self {
17
            FeelError::Parse(msg) => write!(f, "parse error: {msg}"),
18
            FeelError::Eval(msg) => write!(f, "evaluation error: {msg}"),
19
        }
20
    }
21
}
22
23
impl std::error::Error for FeelError {}