Skip to content

Commit

Permalink
Make send_custom_error available on the server as well
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-casperlabs committed Mar 12, 2024
1 parent 9023597 commit 529f17c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,16 @@ where

(deadline, timed_out)
}

/// Injects a custom error.
///
/// Similar to [`JulietRpcClient::send_custom_error`]. This function is available for
/// convenience to allow the server to terminate the connection with an error without having
/// keep a client around.
#[inline]
pub fn send_custom_error(&self, channel: ChannelId, id: Id, error: Bytes) -> bool {
self.handle.enqueue_error(channel, id, error).is_ok()
}
}

impl<const N: usize, R, W> Drop for JulietRpcServer<N, R, W> {
Expand Down

0 comments on commit 529f17c

Please sign in to comment.