Enum tvix_eval::ErrorKind

source ·
pub enum ErrorKind {
Show 36 variants Abort(String), DivisionByZero, DuplicateAttrsKey { key: String, }, InvalidAttributeName(Value), AttributeNotFound { name: String, }, IndexOutOfBounds { index: i64, }, TailEmptyList, TypeError { expected: &'static str, actual: &'static str, }, Incomparable { lhs: &'static str, rhs: &'static str, }, RelativePathResolution(String), DynamicKeyInScope(&'static str), UnknownStaticVariable, UnknownDynamicVariable(String), VariableAlreadyDefined(Span), NotCallable(&'static str), InfiniteRecursion { first_force: Span, suspended_at: Option<Span>, content_span: Option<Span>, }, ParseErrors(Vec<ParseError>), NativeError { gen_type: &'static str, err: Box<Error>, }, BytecodeError(Box<Error>), NotCoercibleToString { from: &'static str, kind: CoercionKind, }, NotAnAbsolutePath(PathBuf), ParseIntError(ParseIntError), UnmergeableInherit { name: SmolStr, }, UnmergeableValue, ImportParseError { path: PathBuf, file: Arc<File>, errors: Vec<ParseError>, }, ImportCompilerError { path: PathBuf, errors: Vec<Error>, }, IO { path: Option<PathBuf>, error: Rc<Error>, }, FromJsonError(String), NotSerialisableToJson(&'static str), FromTomlError(String), UnexpectedArgument { arg: NixString, formals_span: Span, }, Xml(Rc<Error>), TvixError(Rc<dyn Error>), TvixBug { msg: &'static str, metadata: Option<Rc<dyn Debug>>, }, NotImplemented(&'static str), WithContext { context: String, underlying: Box<ErrorKind>, },
}

Variants§

§

Abort(String)

These are user-generated errors through builtins.

§

DivisionByZero

§

DuplicateAttrsKey

Fields

§

InvalidAttributeName(Value)

Attempted to specify an invalid key type (e.g. integer) in a dynamic attribute name.

§

AttributeNotFound

Fields

§name: String
§

IndexOutOfBounds

Fields

§index: i64

Attempted to index into a list beyond its boundaries.

§

TailEmptyList

Attempted to call builtins.tail on an empty list.

§

TypeError

Fields

§expected: &'static str
§actual: &'static str
§

Incomparable

Fields

§lhs: &'static str
§rhs: &'static str
§

RelativePathResolution(String)

Resolving a user-supplied relative or home-relative path literal failed in some way.

§

DynamicKeyInScope(&'static str)

Dynamic keys are not allowed in some scopes.

§

UnknownStaticVariable

Unknown variable in statically known scope.

§

UnknownDynamicVariable(String)

Unknown variable in dynamic scope (with, rec, …).

§

VariableAlreadyDefined(Span)

User is defining the same variable twice at the same depth.

§

NotCallable(&'static str)

Attempt to call something that is not callable.

§

InfiniteRecursion

Fields

§first_force: Span
§suspended_at: Option<Span>
§content_span: Option<Span>

Infinite recursion encountered while forcing thunks.

§

ParseErrors(Vec<ParseError>)

§

NativeError

Fields

§gen_type: &'static str
§err: Box<Error>

An error occured while executing some native code (e.g. a builtin), and needs to be chained up.

§

BytecodeError(Box<Error>)

An error occured while executing Tvix bytecode, but needs to be chained up.

§

NotCoercibleToString

Fields

§from: &'static str

Given type can’t be coerced to a string in the respective context

§

NotAnAbsolutePath(PathBuf)

The given string doesn’t represent an absolute path

§

ParseIntError(ParseIntError)

An error occurred when parsing an integer

§

UnmergeableInherit

Fields

§name: SmolStr

Nested attributes can not be merged with an inherited value.

§

UnmergeableValue

Nested attributes can not be merged with values that are not literal attribute sets.

§

ImportParseError

Fields

§path: PathBuf
§file: Arc<File>
§errors: Vec<ParseError>

Parse errors occured while importing a file.

§

ImportCompilerError

Fields

§path: PathBuf
§errors: Vec<Error>

Compilation errors occured while importing a file.

§

IO

Fields

§error: Rc<Error>

I/O errors

§

FromJsonError(String)

Errors converting JSON to a value

§

NotSerialisableToJson(&'static str)

Nix value that can not be serialised to JSON.

§

FromTomlError(String)

Errors converting TOML to a value

§

UnexpectedArgument

Fields

§formals_span: Span

An unexpected argument was supplied to a function that takes formal parameters

§

Xml(Rc<Error>)

Errors while serialising to XML.

§

TvixError(Rc<dyn Error>)

Variant for errors that bubble up to eval from other Tvix components.

§

TvixBug

Fields

§msg: &'static str
§metadata: Option<Rc<dyn Debug>>

Variant for code paths that are known bugs in Tvix (usually issues with the compiler/VM interaction).

§

NotImplemented(&'static str)

Tvix internal warning for features triggered by users that are not actually implemented yet, and without which eval can not proceed.

§

WithContext

Fields

§context: String
§underlying: Box<ErrorKind>

Internal variant which should disappear during error construction.

Trait Implementations§

source§

impl AddContext for ErrorKind

source§

fn context<S: Into<String>>(self, ctx: S) -> Self

Add context to the error-carrying type.
source§

impl Clone for ErrorKind

source§

fn clone(&self) -> ErrorKind

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ErrorKind

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for ErrorKind

source§

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

Formats the value using the given formatter. Read more
source§

impl From<EmitterError> for ErrorKind

source§

fn from(err: XmlError) -> Self

Converts to this type from the input type.
source§

impl From<Error> for ErrorKind

source§

fn from(err: Error) -> Self

Converts to this type from the input type.
source§

impl From<Error> for ErrorKind

source§

fn from(e: Error) -> Self

Converts to this type from the input type.
source§

impl From<Error> for ErrorKind

source§

fn from(err: Error) -> Self

Converts to this type from the input type.
source§

impl From<FromUtf8Error> for ErrorKind

source§

fn from(_: FromUtf8Error) -> Self

Converts to this type from the input type.
source§

impl From<ParseIntError> for ErrorKind

source§

fn from(e: ParseIntError) -> Self

Converts to this type from the input type.
source§

impl From<Utf8Error> for ErrorKind

source§

fn from(_: Utf8Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V