Skip to content

Commit

Permalink
Clean up some printlns and explain eating the expression errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler committed Jan 13, 2025
1 parent 13d4282 commit 4dbaad7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 4 additions & 1 deletion esi/src/expression.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use fastly::http::Method;
use fastly::Request;
use log::debug;
use regex::RegexBuilder;
use std::fmt::Write;
use std::iter::Peekable;
Expand All @@ -15,7 +16,9 @@ pub fn try_evaluate_interpolated(
) -> Option<Value> {
evaluate_interpolated(cur, ctx)
.map_err(|e| {
println!("Error while evaluating interpolated expression: {e}");
// We eat the error here because a failed expression should result in an empty result
// and not prevent the rest of the file from processing.
debug!("Error while evaluating interpolated expression: {e}");
})
.ok()
}
Expand Down
6 changes: 2 additions & 4 deletions esi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,7 @@ fn event_receiver(
queue.push_back(Element::Raw(result.to_string().into_bytes()));
}
}
Event::ESI(Tag::When { .. }) => {
println!("Shouldn't be possible to get a When tag here");
}
Event::ESI(Tag::When { .. }) => unreachable!(),
Event::ESI(Tag::Choose {
when_branches,
otherwise_events,
Expand All @@ -557,7 +555,7 @@ fn event_receiver(
break;
}
} else {
println!("Somehow got something other than a When in a Choose: {when:?}",);
unreachable!()
}
}

Expand Down

0 comments on commit 4dbaad7

Please sign in to comment.