layer1capital / easy-jsonrpc

Rust crate for generating jsonrpc apis from trait definitions
Apache License 2.0
5 stars 4 forks source link

Return value of handle_request is easy to misinterpret. #5

Closed bddap closed 5 years ago

bddap commented 5 years ago

handle_request should not return an option. Option::None may be interpreted as an error.

https://github.com/mimblewimble/grin-wallet/issues/88

Solution

Return a custom enum from handle_request:

pub enum HandleResponse {
    Call(Value),
    Notification,
}