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 RuntimeError {
18    pub node: Node,
19    pub kind: RuntimeErrorKind,
20}
21
22#[derive(Debug, PartialEq, Eq)]
23pub enum RuntimeErrorKind {
24    StackCouldNotBePopped,
25    VecIndexOutOfBoundsError { tried: i32, size: usize },
26    MapKeyNonExisting,
27    MustHaveGuardArmThatMatches,
28    ValueError(ValueError),
29    ArgumentIsNotMutable,
30    WrongNumberOfArguments(usize, usize),
31    ExpectedOptional,
32    NonUniqueKeysInMapLiteralDetected,
33    NotAnArray,
34    NotSparseValue,
35    CoerceOptionToBoolFailed,
36    VariableWasNotMutable,
37    ContinueNotAllowedHere,
38    BreakNotAllowedHere,
39    NotAMap,
40    NotAMap2,
41    MissingExternalFunction(ExternalFunctionId),
42    ExpectedInt,
43    ExpectedString,
44    RangeItemMustBeInt,
45    OperationRequiresArray,
46    ExpectedFloat,
47    ExpectedTwoFloatTuple,
48    ExpectedFunction,
49    NotSparseId,
50    ReturnNotAllowedHere,
51    ExpectedStruct,
52    ExpectedArray,
53    ExpectedMap,
54    PostfixChainError,
55    IndexOutOfBounds,
56    DivideByZero,
57    MapKeyAlreadyExists,
58    CouldNotConvertFromSignal,
59    UnknownMutIntrinsic,
60    UnknownGenericIntrinsic,
61}