Enum ketos::exec::ExecError [] [src]

pub enum ExecError {
    ArityError {
        name: Option<Name>,
        expected: Arity,
        found: u32,
    },
    CompareNaN,
    CannotCompare(&'static str),
    CannotDefine(Name),
    DivideByZero,
    DuplicateField(Name),
    DuplicateKeyword(Name),
    DuplicateStructDef(Name),
    FieldError {
        struct_name: Name,
        field: Name,
    },
    FieldTypeError {
        struct_name: Name,
        field: Name,
        expected: Name,
        found: &'static str,
        value: Option<Value>,
    },
    FormatError {
        fmt: Box<str>,
        span: Span,
        err: FormatError,
    },
    InvalidClosureValue(u32),
    InvalidConst(u32),
    InvalidDepth,
    InvalidJump(u32),
    InvalidSlice(usizeusize),
    InvalidStack(u32),
    InvalidSystemFn(u32),
    MissingArgCount(Name),
    MissingField {
        struct_name: Name,
        field: Name,
    },
    NameError(Name),
    NotCharBoundary(usize),
    OddKeywordParams,
    OutOfBounds(usize),
    Overflow,
    Panic(Option<Value>),
    StackOverflow,
    StructDefError(Name),
    TypeError {
        expected: &'static str,
        found: &'static str,
        value: Option<Value>,
    },
    StructMismatch {
        lhs: Name,
        rhs: Name,
    },
    TypeMismatch {
        lhs: &'static str,
        rhs: &'static str,
    },
    UnexpectedEnd,
    UnrecognizedKeyword(Name),
    UnrecognizedOpCode(u8),
}

Represents an error generated while executing bytecode.

Variants

ArityError

Error in arity to function call

Fields

name: Option<Name>

Name of function, if available

expected: Arity

Expected count or range of arguments

found: u32

Number of arguments present

CompareNaN

Attempt to compare with a NaN Float value.

CannotCompare(&'static str)

Type does not support ordered comparison

CannotDefine(Name)

Attempt to redefine a name in master scope

DivideByZero

Attempt to divide by a number equal to zero.

DuplicateField(Name)

Duplicate field name in struct definition

DuplicateKeyword(Name)

Duplicate keyword argument to function

DuplicateStructDef(Name)

Duplicate struct definition

FieldError

No such field name in struct

Fields

struct_name: Name

Name of struct type

field: Name

Field name

FieldTypeError

Type error assigning value to field

Fields

struct_name: Name

Name of struct type

field: Name

Name of field

expected: Name

Expected type name

found: &'static str

Name of type received

value: Option<Value>

Value received

FormatError

Error in format call

Fields

fmt: Box<str>

Supplied format string

span: Span

Span within format string

err: FormatError

Formatting error produced

InvalidClosureValue(u32)

Invalid index into closure values

InvalidConst(u32)

Invalid const index

InvalidDepth

Invalid (zero) depth value to Quote, Quasiquote, or Comma instruction

InvalidJump(u32)

Invalid jump label

InvalidSlice(usizeusize)

Slice indices out of order

InvalidStack(u32)

Invalid stack index

InvalidSystemFn(u32)

Invalid system function

MissingArgCount(Name)

CallSys instruction for system function which requires argument count

MissingField

Attempt to construct a Struct without the given field

Fields

struct_name: Name

Struct type name

field: Name

Field name

NameError(Name)

Attempt to lookup a name that did not exist in scope.

NotCharBoundary(usize)

Attempt to slice a string not along UTF-8 code point boundaries.

OddKeywordParams

Odd number of parameters when keyword-value pairs expected

OutOfBounds(usize)

Attempt to access an element in a list that is out of bounds.

Overflow

Integer overflow during certain arithmetic operations.

Panic(Option<Value>)

Code called panic

StackOverflow

Exceeded maximum stack size

StructDefError(Name)

Struct definition not found

TypeError

Operation performed on unexpected type

Fields

expected: &'static str

Name of the type expected

found: &'static str

Name of the type received

value: Option<Value>

Value received

StructMismatch

Function received a value of incorrect type

Fields

lhs: Name

Type of left-hand side value

rhs: Name

Type of right-hand side value

TypeMismatch

Attempt to operate on two values of incompatible types

Fields

lhs: &'static str

Type of left-hand side value

rhs: &'static str

Type of right-hand side value

UnexpectedEnd

Unexpected end in bytecode

UnrecognizedKeyword(Name)

Unrecognized keyword passed to function

UnrecognizedOpCode(u8)

Unrecognized opcode

Methods

impl ExecError
[src]

fn expected(expected: &'static str, v: &Value) -> ExecError

Convenience function to return a TypeError value when expected type is expected, but some other type of value is found.

fn expected_field(struct_name: Name, field: Name, expected: Name, v: &Value) -> ExecError

Convenience function to return a FieldTypeError value when a struct field of the incorrect type is received.

Trait Implementations

impl Debug for ExecError
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Display for ExecError
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl NameDisplay for ExecError
[src]

fn fmt(&self, names: &NameStore, f: &mut Formatter) -> Result

Writes the value's display representation to the formatter stream.