cqrs icon indicating copy to clipboard operation
cqrs copied to clipboard

doc: fix the code snippet of returning Error in fn handle()

Open danglotb opened this issue 2 years ago • 0 comments

Hello,

I was following the documentation, and encountered an error within the code snippet of returning the error in section 3.1. Adding more complex logic.

When I was running cargo build with the current code snippet, I had:

error[E0599]: no variant or associated item named `new` found for enum `AggregateError` in the current scope
   --> src/main.rs:123:48
    |
123 |                     return Err(AggregateError::new("funds not available"));
    |                                                ^^^ variant or associated item not found in `AggregateError<_>`

For more information about this error, try `rustc --explain E0599`.
warning: `mybank` (bin "mybank") generated 1 warning
error: could not compile `mybank` due to previous error; 1 warning emitted

With this fix, the test can be run without error.

Thank you very much for your work! It is amazing :smile:

More info:

$ cargo --version
cargo 1.62.1 (a748cf5a3 2022-06-08)
$ rustc --verbose --version
rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: x86_64-unknown-linux-gnu
release: 1.62.1
LLVM version: 14.0.5

danglotb avatar Aug 20 '22 22:08 danglotb