Enum num_parser::ErrorType
source · [−]pub enum ErrorType {
Show 24 variants
TypeError {
expected: ValueType,
given: ValueType,
},
UnknownToken {
token: String,
},
InvalidTokenPosition {
token: TokenType,
},
FailedCast {
value: Value,
from: ValueType,
to: ValueType,
},
MismatchedArrayLengths {
first: usize,
second: usize,
operation_name: &'static str,
},
DivideByZero {
numerator: Value,
},
NotAnOperator {
token: TokenType,
},
InvalidClosingBracket,
MissingClosingBracket,
MissingOperatorArgument {
token: TokenType,
},
FailedParse {
value: String,
},
EmptyBrackets,
WrongFunctionArgumentsAmount {
func_name: String,
expected: u8,
given: u8,
},
MissingFunctionParameters {
func_name: String,
},
InvalidDeclaration,
UnknownFunction {
func_name: String,
},
UnknownVar {
var_name: String,
},
ReservedVarName {
var_name: String,
},
ReservedFunctionName {
func_name: String,
},
EmptyUnion,
InvalidMutableContext {
request: Request,
},
RecursionDepthLimitReached {
limit: u32,
},
ErrorDuring {
operation_name: &'static str,
error: Box<ErrorType>,
},
InternalError {
message: String,
},
}Expand description
Contains all possible error messages. Implements Display.
use num_parser::*;
let msg = ErrorType::DivideByZero{
numerator: Value::from(2)
}.to_string();
assert_eq!(msg, "MATH ERROR: trying to divide 2 by zero.");Variants
TypeError
A mismatched type.
UnknownToken
Fields
token: StringAn unknown token found while parsing the string.
InvalidTokenPosition
A known token placed in an invalid position.
FailedCast
A failed cast due to data loss.
MismatchedArrayLengths
Two arrays with different lengths.
DivideByZero
Fields
numerator: ValueTrying to divide by zero.
NotAnOperator
A token which is not an operator being used as such.
InvalidClosingBracket
An invalid closing bracket.
MissingClosingBracket
A missing closing bracket.
MissingOperatorArgument
A missing left argument for an operator.
FailedParse
Fields
value: StringAn error occurred while parsing a literal.
EmptyBrackets
Two brackets with nothing inside.
WrongFunctionArgumentsAmount
A function call with the wrong function arguments amount.
MissingFunctionParameters
Fields
func_name: StringA function with no parameters.
InvalidDeclaration
An invalid declaration.
UnknownFunction
Fields
func_name: StringAn unknown function.
UnknownVar
Fields
var_name: StringAn unknown variable.
ReservedVarName
Fields
var_name: StringA reserved variable name.
ReservedFunctionName
Fields
func_name: StringA reserved function name.
EmptyUnion
An empty union ,,
InvalidMutableContext
Invalid request for a static context
RecursionDepthLimitReached
Fields
limit: u32Reached maximum recursion depth.
ErrorDuring
An error wrapper to add additional information.
InternalError
Fields
message: StringAn error due to a missing implementation or a bug. This should never occur.
Trait Implementations
sourceimpl Error for ErrorType
impl Error for ErrorType
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations
impl RefUnwindSafe for ErrorType
impl Send for ErrorType
impl Sync for ErrorType
impl Unpin for ErrorType
impl UnwindSafe for ErrorType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more