* migrate from anyhow to thiserror (#190). pending polish error msgs * Add backtrace and compartmentalize errors - Include backtraces in the errors we generate. To get this we can't just return a literal enum, because the backtrace requires a call. - Related to the previous point: add methods to create errors so we can include the backtrace conveniently without changing too much the syntax. So instead of `Err(Error::KeyNotFound(key))` (literal enum) it will be `Err(Error::key_not_found(key))` (method call) - Each error should be local to its scope, and each scope should only return its own error. - The merkle tree should return `TreeError` and not Error - The middleware should return `MiddlewareError` and not Error - With a global Error we can't easily include backend/frontend types in the error fields, so declare a `BackendError` and a `FrontendError` and follow the pattern from the previous point - The Pod traits should be able to return backend errors and will be used in the frontend; for that we change them to use trait object Error: `dyn std::error::Error` * fix error * apply suggestions from @arnaucube * rename XError and XResult to Error and Result * reorg signature * make frontend custom error more ergonomic * remove unnecessary feature --------- Co-authored-by: Eduard S. <eduardsanou@posteo.net>
39 lines
967 B
TOML
39 lines
967 B
TOML
[package]
|
|
name = "pod2"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[lib]
|
|
name = "pod2"
|
|
path = "src/lib.rs"
|
|
|
|
[dependencies]
|
|
hex = "0.4.3"
|
|
itertools = "0.14.0"
|
|
strum = "0.26"
|
|
strum_macros = "0.26"
|
|
anyhow = "1.0.56"
|
|
dyn-clone = "1.0.18"
|
|
log = "0.4"
|
|
env_logger = "0.11"
|
|
lazy_static = "1.5.0"
|
|
thiserror = { version = "2.0.12" }
|
|
# enabled by features:
|
|
plonky2 = { git = "https://github.com/0xPolygonZero/plonky2", optional = true }
|
|
serde = "1.0.219"
|
|
serde_json = "1.0.140"
|
|
base64 = "0.22.1"
|
|
schemars = "0.8.22"
|
|
|
|
# Uncomment for debugging with https://github.com/ed255/plonky2/ at branch `feat/debug`. The repo directory needs to be checked out next to the pod2 repo directory.
|
|
# [patch."https://github.com/0xPolygonZero/plonky2"]
|
|
# plonky2 = { path = "../plonky2/plonky2" }
|
|
|
|
[dev-dependencies]
|
|
pretty_assertions = "1.4.1"
|
|
# Used only for testing JSON Schema generation and validation.
|
|
jsonschema = "0.30.0"
|
|
|
|
[features]
|
|
default = ["backend_plonky2"]
|
|
backend_plonky2 = ["plonky2"]
|