Skip to content

Commit

Permalink
clip
Browse files Browse the repository at this point in the history
  • Loading branch information
seren5240 committed Aug 12, 2024
1 parent 793f050 commit 8ed3557
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions crates/core/src/foreign_function_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,16 @@ impl FunctionDefinition<MarzanoQueryContext> for ForeignFunctionDefinition {
})?;

#[cfg(feature = "external_functions")]
let result = function.call(&resolved_str).or_else(|e| {
Err(GritPatternError::new(format!(
let result = function.call(&resolved_str).map_err(|e| GritPatternError::new(format!(
"failed to call function {}: {}",
self.name, e
)))
})?;
)))?;
// END embedded version

let string = String::from_utf8(result).or_else(|_| {
Err(GritPatternError::new(format!(
let string = String::from_utf8(result).map_err(|_| GritPatternError::new(format!(
"function {} returned did not return a UTF-8 string",
self.name,
)))
})?;
)))?;

Ok(FuncEvaluation {
predicator: true,
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/marzano_resolved_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,9 @@ impl<'a> ResolvedPattern<'a, MarzanoQueryContext> for MarzanoResolvedPattern<'a>
.into()),
// unsure if this is correct, taken from text
Self::Files(_files) => {
return Err(GritPatternError::new(
Err(GritPatternError::new(
"cannot linearize files pattern, not implemented yet",
));
))
}
// unsure if this is correct, taken from text
Self::Constant(c) => Ok(c.to_string().into()),
Expand Down

0 comments on commit 8ed3557

Please sign in to comment.