Skip to content

Commit 114e1d5

Browse files
authored
Remove panics in EvalExpr, Evaluable, and execute_mut (#374)
1 parent 37bce5e commit 114e1d5

File tree

7 files changed

+293
-151
lines changed

7 files changed

+293
-151
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99
### Changed
10+
- *BREAKING:* partiql-eval: `evaluate` on `Evaluable` returns a `Value` rather than an `Option<Value>`
1011
### Added
12+
- Ability to add and view errors during evaluation with partiql-eval's `EvalContext`
1113
### Fixes
1214

1315
## [0.4.1] - 2023-05-25

partiql-eval/src/error.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ pub struct EvalErr {
3333
#[derive(Error, Debug, Clone, PartialEq, Eq, Hash)]
3434
#[non_exhaustive]
3535
pub enum EvaluationError {
36+
/// Internal error that was not due to user input or API violation.
37+
#[error("Illegal State: {0}")]
38+
IllegalState(String),
3639
/// Malformed evaluation plan with graph containing cycle.
3740
#[error("Evaluation Error: invalid evaluation plan detected `{0}`")]
3841
InvalidEvaluationPlan(String),
42+
/// Feature has not yet been implemented.
43+
#[error("Not yet implemented: {0}")]
44+
NotYetImplemented(String),
3945
}
4046

4147
/// Used when an error occurs during the the logical to eval plan conversion. Allows the conversion
@@ -50,7 +56,7 @@ impl ErrorNode {
5056
}
5157

5258
impl Evaluable for ErrorNode {
53-
fn evaluate(&mut self, _ctx: &dyn EvalContext) -> Option<Value> {
59+
fn evaluate(&mut self, _ctx: &dyn EvalContext) -> Value {
5460
panic!("ErrorNode will not be evaluated")
5561
}
5662

0 commit comments

Comments
 (0)