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_semantic::{ExternalFunctionId, Node};
8
9#[derive(Debug, PartialEq, Eq)]
10pub enum ConversionError {
11    TypeError(String),
12    ValueError(String),
13}
14
15#[derive(Debug, PartialEq, Eq)]
16pub struct ExecuteError {
17    pub node: Node,
18    pub kind: ExecuteErrorKind,
19}
20
21#[derive(Debug, PartialEq, Eq)]
22pub enum ExecuteErrorKind {
23    MustHaveGuardArmThatMatches,
24    ValueError(ValueError),
25    ArgumentIsNotMutable,
26    WrongNumberOfArguments(usize, usize),
27    ExpectedOptional,
28    NonUniqueKeysInMapLiteralDetected,
29    NotAnArray,
30    NotSparseValue,
31    CoerceOptionToBoolFailed,
32    VariableWasNotMutable,
33    ContinueNotAllowedHere,
34    BreakNotAllowedHere,
35    NotAMap,
36    MissingExternalFunction(ExternalFunctionId),
37    ExpectedInt,
38    ExpectedString,
39    RangeItemMustBeInt,
40    OperationRequiresArray,
41    ExpectedFloat,
42    ExpectedTwoFloatTuple,
43    ExpectedFunction,
44    NotSparseId,
45    ReturnNotAllowedHere,
46    ExpectedStruct,
47    ExpectedArray,
48    ExpectedMap,
49    PostfixChainError,
50    IndexOutOfBounds,
51    DivideByZero,
52    MapKeyAlreadyExists,
53    CouldNotConvertFromSignal,
54    UnknownMutIntrinsic,
55}