MCPcopy Create free account
hub / github.com/cel-rust/cel-rust / fail

Function fail

example/src/functions.rs:46–48  ·  view source on GitHub ↗

A function that gives us access to the [`FunctionContext`]. All functions have can accept this context as their first argument. The context is helpful for several reasons: 1. Creating shadowed variables using cloned contexts (see the `filter` and `map` functions for example). 2. Functions that are fallible can return an error message using ftx.error(...) which attaches some helpful context for the

(ftx: &FunctionContext)

Source from the content-addressed store, hash-verified

44/// 2. Functions that are fallible can return an error message using ftx.error(...)
45/// which attaches some helpful context for the error.
46fn fail(ftx: &FunctionContext) -> ResolveResult {
47 ftx.error("This function always fails").into()
48}
49
50/// A function that illustrates all the different types of values that are supported
51/// as arguments to a function, as well as the fact that any of these types can also

Callers

nothing calls this directly

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected