#[non_exhaustive]pub enum ExecutionError {
TokenExpired,
TokenInvalid(String),
CodeMismatch {
expected_hash: String,
actual_hash: String,
},
ContextChanged,
UserMismatch,
BackendError(String),
Timeout(u32),
ValidationRequired,
RuntimeError {
message: String,
},
RequestRefused {
message: String,
},
InvalidScript {
message: String,
},
}Expand description
Errors that can occur during execution.
#[non_exhaustive] since 0.7: a new failure class is a new variant, and a
downstream match must carry a wildcard arm rather than break on each one.
Adding ExecutionError::RequestRefused is what made the enum non-exhaustive
in the first place; it could not be added to an exhaustive enum without
breaking every downstream match, so the two changes travel together.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TokenExpired
TokenInvalid(String)
CodeMismatch
ContextChanged
UserMismatch
BackendError(String)
Timeout(u32)
ValidationRequired
RuntimeError
RequestRefused
A request the script made was REFUSED before it was sent: by the SDK’s path-placeholder floor, by a non-scalar path or query value, or by an embedder’s outbound-request policy.
Distinct from ExecutionError::RuntimeError because the two have
different owners. A runtime fault is the server’s; a refused request is the
CALLER’s to fix by changing what the script sends, so a tool handler should
report it as a tool-level rejection the model can act on and never as an
internal error. Until 0.7 both were RuntimeError, and a policy refusal
reached the model as Internal error: Execution error: Runtime error: ....
message is value-free where it is raised (it names the rule and the
declared expectation, never a rejected byte), and the plan executor keeps
it value-free when it adds the method and result variable.
InvalidScript
The script itself cannot be compiled: a syntax error, a construct the
JavaScript subset does not support, or a call shape the plan compiler
rejects (api.get('/x/' + id) instead of a template literal).
The CALLER wrote the script, so it is the caller’s to fix, and a tool handler
should report it as a tool-level rejection the model can act on, never as an
internal error. Until 0.7.2 this was a ExecutionError::RuntimeError
reading Compilation failed: ..., which hid a caller mistake behind a label
for a server fault.
message comes from CompileError::caller_message: the compiler’s own
guidance for a construct, never a fragment of the submitted code.
Trait Implementations§
Source§impl Debug for ExecutionError
impl Debug for ExecutionError
Source§impl Display for ExecutionError
impl Display for ExecutionError
Source§impl Error for ExecutionError
impl Error for ExecutionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ExecutionError
impl RefUnwindSafe for ExecutionError
impl Send for ExecutionError
impl Sync for ExecutionError
impl Unpin for ExecutionError
impl UnsafeUnpin for ExecutionError
impl UnwindSafe for ExecutionError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more