pub enum Error {
DivisionByZero {
kind: &'static str,
},
Domain {
message: &'static str,
},
UnknownIdentifier {
identifier: Box<str>,
},
InvalidOperand {
func: char,
operand: &'static str,
},
UndefinedConversion {
into: &'static str,
kind: &'static str,
},
Quit(i32),
Parse(ParseError),
InvalidString(InvalidChar),
Io(Error),
Custom(Box<dyn ErrorTrait>),
}
Expand description
An error occurred whilst executing a knight program.
Variants§
DivisionByZero
A division (or modulus) by zero was attempted.
Domain
UnknownIdentifier
An unknown identifier was attempted to be dereferenced.
InvalidOperand
A function was executed with an invalid operand.
UndefinedConversion
A conversion was attempted for a type which doesn’t implement it.
This is only used for Value::Variable
and Value::Function
, as all other types have well-defined conversion semantics.
Fields
Quit(i32)
Exit with the given status code.
Parse(ParseError)
An error occurred whilst parsing (i.e. EVAL
failed).
InvalidString(InvalidChar)
An invalid string was encountered.
Io(Error)
An i/o error occurred (i.e. `
or PROMPT
failed).
Custom(Box<dyn ErrorTrait>)
An error class that can be used to raise other, custom errors.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn ErrorTrait + 'static)>
fn source(&self) -> Option<&(dyn ErrorTrait + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<InvalidChar> for Error
impl From<InvalidChar> for Error
Source§fn from(err: InvalidChar) -> Self
fn from(err: InvalidChar) -> Self
Converts to this type from the input type.
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl !Send for Error
impl !Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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
Mutably borrows from an owned value. Read more