Skip to content

Commit 4cf9205

Browse files
authored
Merge pull request #335 from adorsys/334-improve-errors-catching-mechanisms-in-various-parts-of-the-code
improve errors catching mechanisms in various parts of the code
2 parents 6310eac + 967ef4a commit 4cf9205

File tree

10 files changed

+74
-247
lines changed

10 files changed

+74
-247
lines changed

.env

Lines changed: 0 additions & 7 deletions
This file was deleted.

Cargo.lock

Lines changed: 5 additions & 179 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ chrono = { workspace = true, optional = true }
121121
did-endpoint = { workspace = true, optional = true }
122122
oob-messages = { workspace = true, optional = true }
123123
didcomm-messaging = { workspace = true, optional = true }
124-
reqwest.workspace = true
125124

126125

127126
[features]

crates/web-plugins/didcomm-messaging/protocols/mediator-coordination/src/errors.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use thiserror::Error;
55
/// Represents errors that can occur during mediation.
66
#[derive(Debug, Error, PartialEq, Eq)]
77
pub(crate) enum MediationError {
8+
#[error("Sender DID is missing in the message")]
9+
MissingSenderDID,
810
#[error("No return route all decoration")]
911
NoReturnRouteAllDecoration,
1012
#[error("invalid message type")]
@@ -22,9 +24,9 @@ pub(crate) enum MediationError {
2224
impl IntoResponse for MediationError {
2325
fn into_response(self) -> axum::response::Response {
2426
let status_code = match self {
25-
MediationError::NoReturnRouteAllDecoration | MediationError::InvalidMessageType => {
26-
StatusCode::BAD_REQUEST
27-
}
27+
MediationError::NoReturnRouteAllDecoration
28+
| MediationError::InvalidMessageType
29+
| MediationError::MissingSenderDID => StatusCode::BAD_REQUEST,
2830
MediationError::UncoordinatedSender => StatusCode::UNAUTHORIZED,
2931
MediationError::UnexpectedMessageFormat => StatusCode::BAD_REQUEST,
3032
MediationError::InternalServerError => StatusCode::INTERNAL_SERVER_ERROR,

0 commit comments

Comments
 (0)