Skip to content

Commit 859af8d

Browse files
committed
fix: box RpcError in RpcCallError::Rpc to reduce enum size
1 parent f6e5829 commit 859af8d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

api/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl SendRequestError {
322322
impl From<RpcCallError> for SendRequestError {
323323
fn from(err: RpcCallError) -> Self {
324324
match err {
325-
RpcCallError::Rpc(rpc_err) => Self::ServerError(rpc_err),
325+
RpcCallError::Rpc(rpc_err) => Self::ServerError(*rpc_err),
326326
other => Self::TransportError(other),
327327
}
328328
}

api/src/rpc_client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub enum RpcCallError {
3939
#[error("HTTP error: {0}")]
4040
Http(#[from] reqwest::Error),
4141
#[error("RPC error: {0}")]
42-
Rpc(RpcError),
42+
Rpc(Box<RpcError>),
4343
#[error("JSON deserialization error: {0}")]
4444
Deserialize(serde_json::Error),
4545
}
@@ -75,7 +75,7 @@ impl RpcClient {
7575
serde_json::from_slice(&bytes).map_err(RpcCallError::Deserialize)?;
7676

7777
if let Some(error) = response.error {
78-
return Err(RpcCallError::Rpc(error));
78+
return Err(RpcCallError::Rpc(Box::new(error)));
7979
}
8080

8181
response.result.map_or_else(

0 commit comments

Comments
 (0)