Enum tvix_eval::errors::ErrorKind

source ·
pub enum ErrorKind {
Show 41 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, InvalidHash(String), 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

Attempted to index into a list beyond its boundaries.

Fields

§index: i64
§

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

Infinite recursion encountered while forcing thunks.

Fields

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

ParseErrors(Vec<ParseError>)

§

NativeError

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

Fields

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

BytecodeError(Box<Error>)

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

§

NotCoercibleToString

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

Fields

§from: &'static str
§

NotAnAbsolutePath(PathBuf)

The given string doesn’t represent an absolute path

§

ParseIntError(ParseIntError)

An error occurred when parsing an integer

§

UnmergeableInherit

Nested attributes can not be merged with an inherited value.

Fields

§name: SmolStr
§

UnmergeableValue

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

§

ImportParseError

Parse errors occured while importing a file.

Fields

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

ImportCompilerError

Compilation errors occured while importing a file.

Fields

§path: PathBuf
§errors: Vec<Error>
§

IO

I/O errors

Fields

§error: Rc<Error>
§

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

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

Fields

§formals_span: Span
§

Utf8

Invalid UTF-8 was encoutered somewhere

§

InvalidHash(String)

§

TvixError(Rc<dyn Error>)

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

§

TvixBug

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

Fields

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

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

Internal variant which should disappear during error construction.

Fields

§context: String
§underlying: Box<ErrorKind>
§

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, __formatter: &mut Formatter<'_>) -> Result

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

impl Error for ErrorKind

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
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<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<FromUtf8Error> for ErrorKind

source§

fn from(_value: 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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

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>,

source§

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>,

source§

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