Enum tvix_eval::CatchableErrorKind
source · pub enum CatchableErrorKind {
Throw(String),
AssertionFailed,
NixPathResolution(String),
}
Expand description
“CatchableErrorKind” errors – those which can be detected by
builtins.tryEval
.
Note: this type is deliberately not incorporated as a variant of ErrorKind, because then Result<Value,ErrorKind> would have redundant representations for catchable errors, which would make it too easy to handle errors incorrectly:
- Ok(Value::Catchable(cek))
- Err(ErrorKind::ThisVariantDoesNotExist(cek))
Because CatchableErrorKind is not a variant of ErrorKind, you will often see functions which return a type like:
Result<Result<T,CatchableErrorKind>,ErrorKind>
… where T is any type other than Value. This is unfortunate,
because Rust’s magic ?
-syntax does not work on nested Result
values like this.
TODO(amjoseph): investigate result<T,Either<CatchableErrorKind,ErrorKind>>
Variants§
Throw(String)
AssertionFailed
NixPathResolution(String)
Resolving a user-supplied angle brackets path literal failed in some way.
Trait Implementations§
source§impl Clone for CatchableErrorKind
impl Clone for CatchableErrorKind
source§fn clone(&self) -> CatchableErrorKind
fn clone(&self) -> CatchableErrorKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more