Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f067e62
feat!: give bad requests a clear error, and make error enums non-exha…
Frando Oct 5, 2026
c2d3cd3
feat: add Handler::skip_bad_requests
Frando Oct 6, 2026
79db976
feat!: a remote receiver stops its stream if a message does not decode
Frando Oct 5, 2026
d46c163
fix: skip a request whose stream ends before the request is complete
Frando Oct 7, 2026
139631e
test: check that a request that is too large closes the connection
Frando Oct 7, 2026
a6e5411
docs: say that applications should not use error codes 0 to 15
Frando Oct 7, 2026
09c78d5
feat: a client resets the stream of a request that it drops
Frando Oct 7, 2026
28a5369
refactor: name the outcomes of reading a request stream
Frando Oct 8, 2026
c140bbd
feat: give a request that does not decode its own error variant
Frando Oct 8, 2026
f303634
refactor: let the handler branch on the error code of a read error
Frando Oct 8, 2026
c97126b
fix: a sender gets ReceiverClosed if the remote receiver is dropped
rklaehn Oct 9, 2026
c9feb62
fix: later sends get ReceiverClosed too after the remote receiver is …
rklaehn Oct 9, 2026
ede7fde
refactor: make receiver_closed a flag on the closed state
rklaehn Oct 9, 2026
390eebe
refactor: store why a sender closed as a CloseReason
rklaehn Oct 9, 2026
5ef4105
fix: a oneshot receiver gets SenderClosed if the remote sender is dro…
rklaehn Oct 9, 2026
8ca052f
tests: add proto test for receiver closed
Frando Oct 9, 2026
7fbbc6b
refactor: cleanups for error refactor (#137)
Frando Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ mod storage {
StorageMessage::Auth(msg) => {
let WithChannels { inner, tx, .. } = msg;
if authed {
conn.close(1u32.into(), b"invalid message");
conn.close(400u32.into(), b"invalid message");
break;
} else if inner.token != self.auth_token {
conn.close(1u32.into(), b"permission denied");
conn.close(401u32.into(), b"permission denied");
break;
} else {
authed = true;
Expand All @@ -148,7 +148,7 @@ mod storage {
}
msg => {
if !authed {
conn.close(1u32.into(), b"permission denied");
conn.close(401u32.into(), b"permission denied");
break;
} else {
self.handle_authenticated(msg).await;
Expand Down
8 changes: 6 additions & 2 deletions src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ pub mod oneshot;
/// For rpc communication, there can be any number of errors, so this is a
/// generic io error.
#[stack_error(derive, add_meta, from_sources)]
#[non_exhaustive]
pub enum SendError {
/// The receiver has been closed. This is the only error that can occur
/// for local communication.
/// The receiver has been closed.
///
/// This is the only error that can occur for local communication. For
/// remote communication, this means that the receiver stopped the stream
/// with code 0, for example because it was dropped.
#[error("Receiver closed")]
ReceiverClosed,
/// The message exceeded the maximum allowed message size (see [`MAX_MESSAGE_SIZE`]).
Expand Down
1 change: 1 addition & 0 deletions src/channel/mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use super::SendError;
/// For rpc communication, there can be any number of errors, so this is a
/// generic io error.
#[stack_error(derive, add_meta, from_sources)]
#[non_exhaustive]
pub enum RecvError {
/// The message exceeded the maximum allowed message size (see [`MAX_MESSAGE_SIZE`]).
///
Expand Down
8 changes: 6 additions & 2 deletions src/channel/oneshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ use crate::util::FusedOneshotReceiver;
/// For rpc communication, there can be any number of errors, so this is a
/// generic io error.
#[stack_error(derive, add_meta, from_sources)]
#[non_exhaustive]
pub enum RecvError {
/// The sender has been closed. This is the only error that can occur
/// for local communication.
/// The sender has been closed.
///
/// This is the only error that can occur for local communication. For
/// remote communication, this means that the sender finished the stream
/// without sending, for example because it was dropped.
#[error("Sender closed")]
SenderClosed,
/// The message exceeded the maximum allowed message size (see [`MAX_MESSAGE_SIZE`]).
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ impl<M> ClientInner<M> {
/// Error when opening a request. When cross-process rpc is disabled, this is
/// an empty enum since local requests can not fail.
#[stack_error(derive, add_meta, from_sources)]
#[non_exhaustive]
pub enum RequestError {
/// Error in noq during connect
#[cfg(feature = "rpc")]
Expand Down Expand Up @@ -976,6 +977,7 @@ pub enum RequestError {

/// Error type that subsumes all possible errors in this crate, for convenience.
#[stack_error(derive, add_meta, from_sources)]
#[non_exhaustive]
pub enum Error {
#[error("Request error")]
Request { source: RequestError },
Expand Down
Loading
Loading