Enum tvix_eval::ErrorKind

source ·
pub enum ErrorKind {
Show 40 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(Option<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>, }, JsonError(String), NotSerialisableToJson(&'static str), FromTomlError(String), UnexpectedArgumentBuiltin(NixString), UnexpectedArgumentFormals { arg: NixString, formals_span: Span, }, Utf8, TvixError(Rc<dyn Error>), TvixBug { msg: &'static str, metadata: Option<Rc<dyn Debug>>, }, NotImplemented(&'static str), WithContext { context: String, underlying: Box<ErrorKind>, }, UnexpectedContext, CatchableError(CatchableErrorKind), UnknownHashType(String),
}

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(Option<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

§

JsonError(String)

Errors parsing JSON, or serializing as JSON.

§

NotSerialisableToJson(&'static str)

Nix value that can not be serialised to JSON.

§

FromTomlError(String)

Errors converting TOML to a value

§

UnexpectedArgumentBuiltin(NixString)

An unexpected argument was supplied to a builtin

§

UnexpectedArgumentFormals

Fields

§formals_span: Span

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

§

Utf8

Invalid UTF-8 was encoutered somewhere

§

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.

§

UnexpectedContext

Unexpected context string

§

CatchableError(CatchableErrorKind)

Top-level evaluation result was a catchable Nix error, and should fail the evaluation.

This variant must only be used at the top-level of tvix-eval when returning a result to the user, never inside of eval code.

§

UnknownHashType(String)

Invalid hash type specified, must be one of “md5”, “sha1”, “sha256” or “sha512”

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<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(_value: FromUtf8Error) -> 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.
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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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> ToSmolStr for T
where T: Display + ?Sized,

source§

impl<T> ToString for T
where 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 T
where 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 T
where 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 T
where V: MultiLane<T>,

source§

fn vzip(self) -> V