swamp_script_eval/
err.rs

1/*
2 * Copyright (c) Peter Bjorklund. All rights reserved. https://github.com/swamp/script
3 * Licensed under the MIT License. See LICENSE in the project root for license information.
4 */
5
6use swamp_script_core_extra::value::ValueError;
7use swamp_script_node::Node;
8use swamp_script_semantic::ExternalFunctionId;
9
10#[derive(Debug, PartialEq, Eq)]
11pub enum ConversionError {
12    TypeError(String),
13    ValueError(String),
14}
15
16#[derive(Debug, PartialEq, Eq)]
17pub struct ExecuteError {
18    pub node: Node,
19    pub kind: ExecuteErrorKind,
20}
21
22#[derive(Debug, PartialEq, Eq)]
23pub enum ExecuteErrorKind {
24    MustHaveGuardArmThatMatches,
25    ValueError(ValueError),
26    ArgumentIsNotMutable,
27    WrongNumberOfArguments(usize, usize),
28    ExpectedOptional,
29    NonUniqueKeysInMapLiteralDetected,
30    NotAnArray,
31    NotSparseValue,
32    CoerceOptionToBoolFailed,
33    VariableWasNotMutable,
34    ContinueNotAllowedHere,
35    BreakNotAllowedHere,
36    NotAMap,
37    MissingExternalFunction(ExternalFunctionId),
38    ExpectedInt,
39    ExpectedString,
40    RangeItemMustBeInt,
41    OperationRequiresArray,
42    ExpectedFloat,
43    ExpectedTwoFloatTuple,
44    ExpectedFunction,
45    NotSparseId,
46    ReturnNotAllowedHere,
47    ExpectedStruct,
48    ExpectedArray,
49    ExpectedMap,
50    PostfixChainError,
51    IndexOutOfBounds,
52    DivideByZero,
53    MapKeyAlreadyExists,
54    CouldNotConvertFromSignal,
55    UnknownMutIntrinsic,
56    UnknownGenericIntrinsic,
57}