Skip to content

Commit

Permalink
made session and link errors public
Browse files Browse the repository at this point in the history
  • Loading branch information
minghuaw committed Mar 11, 2022
1 parent 1eee8fc commit 8e1157a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fe2o3-amqp/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
connection::{engine::SessionId, AllocSessionError},
endpoint::LinkFlow,
link::LinkHandle,
session::{error::AllocLinkError, frame::SessionIncomingItem},
session::{AllocLinkError, frame::SessionIncomingItem},
};

#[derive(Debug)]
Expand Down
7 changes: 6 additions & 1 deletion fe2o3-amqp/src/link/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use fe2o3_amqp_types::{
};
use tokio::sync::mpsc;

use crate::session::error::AllocLinkError;
use crate::session::AllocLinkError;

/// Error associated with detaching a link
#[derive(Debug)]
Expand Down Expand Up @@ -202,17 +202,22 @@ pub(crate) fn detach_error_expecting_frame<L>(link: L) -> DetachError<L> {
}
}

/// Error associated with attaching a link
#[derive(Debug, thiserror::Error)]
pub enum AttachError {
/// Session is in an illegal state
#[error("Illegal session state")]
IllegalSessionState,

/// Session's max number of handle has reached
#[error("Handle max reached")]
HandleMaxReached,

/// Link name is duplicated
#[error("Link name must be unique")]
DuplicatedLinkName,

/// A local error
#[error("Local error: {:?}", .0)]
LocalError(definitions::Error),
}
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp/src/link/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub mod sender;
mod sender_link;
pub mod state;

pub use error::Error;
pub use error::*;

use futures_util::{Sink, SinkExt, Stream};
pub use receiver::Receiver;
Expand Down
6 changes: 4 additions & 2 deletions fe2o3-amqp/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ use crate::{

pub(crate) mod engine;
pub(crate) mod frame;
pub(crate) mod error;

mod error;
pub(crate) use error::AllocLinkError;
pub use error::Error;

mod builder;
pub use builder::*;

use self::{
error::{AllocLinkError, Error},
frame::{SessionFrame, SessionFrameBody},
};

Expand Down

0 comments on commit 8e1157a

Please sign in to comment.