Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better handling of Seralization Errors internally #2

Open
volfco opened this issue Mar 21, 2021 · 0 comments
Open

Add better handling of Seralization Errors internally #2

volfco opened this issue Mar 21, 2021 · 0 comments

Comments

@volfco
Copy link
Owner

volfco commented Mar 21, 2021

Right now, ZkStruct can blow up if the struct changes; like so:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("missing field `resources`", line: 0, column: 0)', /home/colum/.cargo/registry/src/github.com-1ecc6299db9ec823/zkstate-0.1.6/src/lib.rs:249:43
stack backtrace:
   0: rust_begin_unwind
             at /rustc/b3e19a221e63dcffdef87e12eadf1f36a8b90295/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/b3e19a221e63dcffdef87e12eadf1f36a8b90295/library/core/src/panicking.rs:92:14
   2: core::option::expect_none_failed
             at /rustc/b3e19a221e63dcffdef87e12eadf1f36a8b90295/library/core/src/option.rs:1329:5
   3: core::result::Result<T,E>::unwrap
             at /home/colum/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1037:23
   4: zkstate::state_change
             at /home/colum/.cargo/registry/src/github.com-1ecc6299db9ec823/zkstate-0.1.6/src/lib.rs:249:17
   5: zkstate::ZkState<T>::initialize
             at /home/colum/.cargo/registry/src/github.com-1ecc6299db9ec823/zkstate-0.1.6/src/lib.rs:90:9
   6: zkstate::ZkState<T>::new
             at /home/colum/.cargo/registry/src/github.com-1ecc6299db9ec823/zkstate-0.1.6/src/lib.rs:71:9
   7: stardance::executor::Executor::new
             at ./stardance/src/executor.rs:43:19
   8: executor::main
             at ./stardance/examples/executor.rs:42:20
   9: core::ops::function::FnOnce::call_once
             at /home/colum/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

There should be:

  1. better handling of this error so it doesn't panic
  2. documentation around best practices on changing the fields of this object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant