Skip to content

Commit 1f8c8c5

Browse files
authored
chore: release v0.18.0 (#1092)
* chore: release v0.18.0 * add PR link in the release * link to latest in README * fix rust example * Update CHANGELOG.md * Update CHANGELOG.md * update changelog
1 parent e58e021 commit 1f8c8c5

File tree

3 files changed

+83
-10
lines changed

3 files changed

+83
-10
lines changed

CHANGELOG.md

+73
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,79 @@ The format is based on [Keep a Changelog].
44

55
[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/
66

7+
## [v0.18.0] - 2023-04-21
8+
9+
This is a breaking release that removes the `CallError` which was used to represent a JSON-RPC error object that
10+
could happen during JSON-RPC method call and one could assign application specific error code, message and data in a
11+
specific implementation.
12+
13+
Previously jsonrpsee provided `CallError` that could be converted to/from `jsonrpsee::core::Error`
14+
and in some scenarios the error code was automatically assigned by jsonrpsee. After jsonrpsee
15+
added support for custom error types the `CallError` doesn't provide any benefit because one has to implement `Into<ErrorObjectOwned>`
16+
on the error type anyway.
17+
18+
Thus, `jsonrpsee::core::Error` can't be used in the proc macro API anymore and the type alias
19+
`RpcResult` has been modified to `Result<(), ErrorObjectOwned>` instead.
20+
21+
Before it was possible to do:
22+
23+
```rust
24+
#[derive(thiserror::Error)]
25+
enum Error {
26+
A,
27+
B,
28+
}
29+
30+
#[rpc(server, client)]
31+
pub trait Rpc
32+
{
33+
#[method(name = "getKeys")]
34+
async fn keys(&self) -> Result<String, jsonrpsee::core::Error> {
35+
Err(jsonrpsee::core::Error::to_call_error(Error::A))
36+
// or jsonrpsee::core::Error::Call(CallError::Custom(ErrorObject::owned(1, "a", None::<()>)))
37+
}
38+
}
39+
```
40+
41+
After this change one has to do:
42+
43+
```rust
44+
pub enum Error {
45+
A,
46+
B,
47+
}
48+
49+
impl From<Error> for ErrorObjectOwned {
50+
fn from(e: Error) -> Self {
51+
match e {
52+
Error::A => ErrorObject::owned(1, "a", None::<()>),
53+
Error::B => ErrorObject::owned(2, "b", None::<()>),
54+
}
55+
}
56+
}
57+
58+
#[rpc(server, client)]
59+
pub trait Rpc {
60+
// Use a custom error type that implements `Into<ErrorObject>`
61+
#[method(name = "custom_err_ty")]
62+
async fn custom_err_type(&self) -> Result<String, Error> {
63+
Err(Error::A)
64+
}
65+
66+
// Use `ErrorObject` as error type directly.
67+
#[method(name = "err_obj")]
68+
async fn error_obj(&self) -> RpcResult<String> {
69+
Err(ErrorObjectOwned::owned(1, "c", None::<()>))
70+
}
71+
}
72+
```
73+
74+
### [Changed]
75+
- remove `CallError` ([#1087](https://github.com/paritytech/jsonrpsee/pull/1087))
76+
77+
### [Fixed]
78+
- fix(proc macros): support parsing params !Result ([#1094](https://github.com/paritytech/jsonrpsee/pull/1094))
79+
780
## [v0.17.1] - 2023-04-21
881

982
This release fixes HTTP graceful shutdown for the server.

Cargo.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ resolver = "2"
1919

2020
[workspace.package]
2121
authors = ["Parity Technologies <[email protected]>", "Pierre Krieger <[email protected]>"]
22-
version = "0.17.1"
22+
version = "0.18.0"
2323
edition = "2021"
2424
rust-version = "1.64.0"
2525
license = "MIT"
@@ -30,11 +30,11 @@ keywords = ["jsonrpc", "json", "http", "websocket", "WASM"]
3030
readme = "README.md"
3131

3232
[workspace.dependencies]
33-
jsonrpsee-types = { path = "types", version = "0.17.1" }
34-
jsonrpsee-core = { path = "core", version = "0.17.1" }
35-
jsonrpsee-server = { path = "server", version = "0.17.1" }
36-
jsonrpsee-ws-client = { path = "client/ws-client", version = "0.17.1" }
37-
jsonrpsee-http-client = { path = "client/http-client", version = "0.17.1" }
38-
jsonrpsee-wasm-client = { path = "client/wasm-client", version = "0.17.1" }
39-
jsonrpsee-client-transport = { path = "client/transport", version = "0.17.1" }
40-
jsonrpsee-proc-macros = { path = "proc-macros", version = "0.17.1" }
33+
jsonrpsee-types = { path = "types", version = "0.18.0" }
34+
jsonrpsee-core = { path = "core", version = "0.18.0" }
35+
jsonrpsee-server = { path = "server", version = "0.18.0" }
36+
jsonrpsee-ws-client = { path = "client/ws-client", version = "0.18.0" }
37+
jsonrpsee-http-client = { path = "client/http-client", version = "0.18.0" }
38+
jsonrpsee-wasm-client = { path = "client/wasm-client", version = "0.18.0" }
39+
jsonrpsee-client-transport = { path = "client/transport", version = "0.18.0" }
40+
jsonrpsee-proc-macros = { path = "proc-macros", version = "0.18.0" }

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
![MIT](https://img.shields.io/crates/l/jsonrpsee.svg)
77
[![CI](https://github.com/paritytech/jsonrpsee/actions/workflows/ci.yml/badge.svg)](https://github.com/paritytech/jsonrpsee/actions/workflows/ci.yml)
88
[![Benchmarks](https://github.com/paritytech/jsonrpsee/actions/workflows/benchmarks.yml/badge.svg)](https://github.com/paritytech/jsonrpsee/actions/workflows/benchmarks.yml)
9-
[![dependency status](https://deps.rs/crate/jsonrpsee/0.17.1/status.svg)](https://deps.rs/crate/jsonrpsee/0.17.1)
9+
[![dependency status](https://deps.rs/crate/jsonrpsee/0.18.0/status.svg)](https://deps.rs/crate/jsonrpsee/0.18.0)
1010

1111
JSON-RPC library designed for async/await in Rust.
1212

0 commit comments

Comments
 (0)