feat: introduce miette into uplc

This commit is contained in:
rvcas 2023-03-08 01:09:00 -05:00 committed by KtorZ
parent cb11b21c9f
commit 4f1d14f2a0
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
4 changed files with 5 additions and 3 deletions

1
Cargo.lock generated vendored
View File

@ -2721,6 +2721,7 @@ dependencies = [
"indexmap",
"itertools",
"k256",
"miette",
"num-bigint",
"num-integer",
"num-traits",

View File

@ -20,6 +20,7 @@ hex = "0.4.3"
indexmap = "1.9.2"
itertools = "0.10.5"
k256 = { version = "0.13.0", optional = true }
miette = "5.5.0"
num-bigint = "0.4.3"
num-integer = "0.1.45"
num-traits = "0.2.15"

View File

@ -6,13 +6,13 @@ use crate::ast::{NamedDeBruijn, Term, Type};
use super::{ExBudget, Value};
#[derive(thiserror::Error, Debug)]
#[derive(thiserror::Error, Debug, miette::Diagnostic)]
pub enum Error {
#[error("Over budget mem: {} & cpu: {}", .0.mem, .0.cpu)]
OutOfExError(ExBudget),
#[error("Invalid Stepkind: {0}")]
InvalidStepKind(u8),
#[error("Cannot evaluate an open term:\n\n{0}")]
#[error("Cannot evaluate an open term:\\n\\n{}", .0.to_pretty())]
OpenTermEvaluated(Term<NamedDeBruijn>),
#[error("The provided Plutus code called 'error'.")]
EvaluationFailure,

View File

@ -1,6 +1,6 @@
use crate::machine::{self, cost_model::ExBudget};
#[derive(thiserror::Error, Debug)]
#[derive(thiserror::Error, Debug, miette::Diagnostic)]
pub enum Error {
#[error("{0}")]
Address(#[from] pallas_addresses::Error),