Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore: cowify error response (#2208)

Sean Ayeb9ab4c408264
diff --git a/rust/cloud-storage/authentication_service/src/api/email/generate_email_link.rs b/rust/cloud-storage/authentication_service/src/api/email/generate_email_link.rs
index 0a2fe00a25..8fafd79fc9 100644
--- a/rust/cloud-storage/authentication_service/src/api/email/generate_email_link.rs
+++ b/rust/cloud-storage/authentication_service/src/api/email/generate_email_link.rs
@@ -98,7 +98,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "user profile already exists",
+ message: "user profile already exists".into(),
}),
)
.into_response());
@@ -110,7 +110,7 @@ pub async fn handler(
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to check for existing user profile",
+ message: "unable to check for existing user profile".into(),
}),
)
.into_response());
@@ -137,7 +137,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "email already in progress",
+ message: "email already in progress".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/authentication_service/src/api/email/verify_email_link.rs b/rust/cloud-storage/authentication_service/src/api/email/verify_email_link.rs
index 84417da6ed..4c839a9818 100644
--- a/rust/cloud-storage/authentication_service/src/api/email/verify_email_link.rs
+++ b/rust/cloud-storage/authentication_service/src/api/email/verify_email_link.rs
@@ -58,7 +58,7 @@ pub async fn handler(
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "invalid verification id",
+ message: "invalid verification id".into(),
}),
)
.into_response());
@@ -71,7 +71,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "cannot verify email link. user profile already exists. use account merge instead",
+ message: "cannot verify email link. user profile already exists. use account merge instead".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/authentication_service/src/api/internal/google_access_token.rs b/rust/cloud-storage/authentication_service/src/api/internal/google_access_token.rs
index d4f248d1fc..2d5c731af7 100644
--- a/rust/cloud-storage/authentication_service/src/api/internal/google_access_token.rs
+++ b/rust/cloud-storage/authentication_service/src/api/internal/google_access_token.rs
@@ -46,7 +46,7 @@ async fn get_access_token(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to find idp",
+ message: "unable to find idp".into(),
}),
)
.into_response()
@@ -61,7 +61,7 @@ async fn get_access_token(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch links",
+ message: "unable to fetch links".into(),
}),
)
.into_response()
@@ -82,7 +82,7 @@ async fn get_access_token(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
message: format!("No {} link found for this user", identity_provider_name)
- .as_str(),
+ .into(),
}),
)
.into_response()
@@ -99,7 +99,7 @@ async fn get_access_token(
_ => StatusCode::INTERNAL_SERVER_ERROR,
};
let message = format!("unable to fetch {} access token", identity_provider_name);
- (status_code, Json(ErrorResponse { message: &message })).into_response()
+ (status_code, Json(ErrorResponse { message: message.into() })).into_response()
})?;
Ok((
diff --git a/rust/cloud-storage/authentication_service/src/api/internal/post_get_existing_users.rs b/rust/cloud-storage/authentication_service/src/api/internal/post_get_existing_users.rs
index 13271a8f37..946afc3840 100644
--- a/rust/cloud-storage/authentication_service/src/api/internal/post_get_existing_users.rs
+++ b/rust/cloud-storage/authentication_service/src/api/internal/post_get_existing_users.rs
@@ -35,7 +35,7 @@ pub enum GetExistingUsersError {
impl IntoResponse for GetExistingUsersError {
fn into_response(self) -> Response {
- let status_code = match self {
+ let status_code = match &self {
GetExistingUsersError::InvalidMacroId => StatusCode::BAD_REQUEST,
GetExistingUsersError::InternalError(_) => StatusCode::INTERNAL_SERVER_ERROR,
};
@@ -43,7 +43,7 @@ impl IntoResponse for GetExistingUsersError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs b/rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs
index e40df04585..405f9f7760 100644
--- a/rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs
+++ b/rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs
@@ -49,7 +49,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "no identity provider found",
+ message: "no identity provider found".into(),
}),
)
.into_response()
@@ -59,7 +59,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get identity provider id by name",
+ message: "unable to get identity provider id by name".into(),
}),
)
.into_response()
@@ -77,7 +77,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch links",
+ message: "unable to fetch links".into(),
}),
)
.into_response()
@@ -99,7 +99,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: format!("No {} link found for this user", idp_name).as_str(),
+ message: format!("No {} link found for this user", idp_name).into(),
}),
)
.into_response()
@@ -121,7 +121,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "no identity provider found",
+ message: "no identity provider found".into(),
}),
)
.into_response()
@@ -131,7 +131,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to unlink user",
+ message: "unable to unlink user".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/link/create_in_progress_link.rs b/rust/cloud-storage/authentication_service/src/api/link/create_in_progress_link.rs
index f94261b6ce..63a9ed2e54 100644
--- a/rust/cloud-storage/authentication_service/src/api/link/create_in_progress_link.rs
+++ b/rust/cloud-storage/authentication_service/src/api/link/create_in_progress_link.rs
@@ -48,7 +48,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get current link count",
+ message: "unable to get current link count".into(),
}),
)
.into_response()
@@ -58,7 +58,7 @@ pub async fn handler(
return Err((
StatusCode::TOO_MANY_REQUESTS,
Json(ErrorResponse {
- message: "you have too many in progress links. resolve them or wait 24 hours before creating new ones",
+ message: "you have too many in progress links. resolve them or wait 24 hours before creating new ones".into(),
}),
).into_response());
}
@@ -73,7 +73,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to create in progress user link",
+ message: "unable to create in progress user link".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/link/github.rs b/rust/cloud-storage/authentication_service/src/api/link/github.rs
index a3d623c9c1..86d8f380b3 100644
--- a/rust/cloud-storage/authentication_service/src/api/link/github.rs
+++ b/rust/cloud-storage/authentication_service/src/api/link/github.rs
@@ -41,7 +41,7 @@ pub enum InitGithubLinkError {
impl IntoResponse for InitGithubLinkError {
fn into_response(self) -> Response {
- let message: &str = &self.to_string();
+ let message = self.to_string();
let status_code: StatusCode = match &self {
InitGithubLinkError::InvalidUserId(_) => StatusCode::BAD_REQUEST,
InitGithubLinkError::TooManyInProgressLinks => StatusCode::TOO_MANY_REQUESTS,
@@ -50,7 +50,13 @@ impl IntoResponse for InitGithubLinkError {
| InitGithubLinkError::IdentityProviderNotFound => StatusCode::INTERNAL_SERVER_ERROR,
};
- (status_code, Json(ErrorResponse { message })).into_response()
+ (
+ status_code,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/authentication_service/src/api/login/apple.rs b/rust/cloud-storage/authentication_service/src/api/login/apple.rs
index ed6c7a755e..c561950536 100644
--- a/rust/cloud-storage/authentication_service/src/api/login/apple.rs
+++ b/rust/cloud-storage/authentication_service/src/api/login/apple.rs
@@ -45,7 +45,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to find idp",
+ message: "unable to find idp".into(),
}),
)
.into_response()
@@ -60,7 +60,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to complete apple login",
+ message: "unable to complete apple login".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/login/password.rs b/rust/cloud-storage/authentication_service/src/api/login/password.rs
index ce573aa04d..2033a99dc9 100644
--- a/rust/cloud-storage/authentication_service/src/api/login/password.rs
+++ b/rust/cloud-storage/authentication_service/src/api/login/password.rs
@@ -40,7 +40,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid email",
+ message: "invalid email".into(),
}),
)
.into_response());
@@ -62,7 +62,7 @@ pub async fn handler(
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "user has not verified their primary email",
+ message: "user has not verified their primary email".into(),
}),
)
.into_response());
@@ -76,7 +76,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to register user",
+ message: "unable to register user".into(),
}),
)
.into_response()
@@ -91,7 +91,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to login user",
+ message: "unable to login user".into(),
}),
)
.into_response()
@@ -101,7 +101,7 @@ pub async fn handler(
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to login user",
+ message: "unable to login user".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/authentication_service/src/api/login/passwordless.rs b/rust/cloud-storage/authentication_service/src/api/login/passwordless.rs
index b82a1a6996..500641d51b 100644
--- a/rust/cloud-storage/authentication_service/src/api/login/passwordless.rs
+++ b/rust/cloud-storage/authentication_service/src/api/login/passwordless.rs
@@ -119,7 +119,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid macro user id",
+ message: "invalid macro user id".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/login/sso.rs b/rust/cloud-storage/authentication_service/src/api/login/sso.rs
index f7bb6a7381..f891f3ba45 100644
--- a/rust/cloud-storage/authentication_service/src/api/login/sso.rs
+++ b/rust/cloud-storage/authentication_service/src/api/login/sso.rs
@@ -73,7 +73,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "idp_name or idp_id need to be provided",
+ message: "idp_name or idp_id need to be provided".into(),
}),
)
.into_response());
@@ -85,7 +85,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "provided idp_id is empty",
+ message: "provided idp_id is empty".into(),
}),
)
.into_response());
@@ -100,7 +100,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "provided idp_name is empty",
+ message: "provided idp_name is empty".into(),
}),
)
.into_response());
@@ -115,7 +115,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to find idp from idp_name",
+ message: "unable to find idp from idp_name".into(),
}),
)
.into_response()
@@ -146,7 +146,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "unable to serialize state into string",
+ message: "unable to serialize state into string".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/merge/create_merge_request.rs b/rust/cloud-storage/authentication_service/src/api/merge/create_merge_request.rs
index 06251c0d34..458692f066 100644
--- a/rust/cloud-storage/authentication_service/src/api/merge/create_merge_request.rs
+++ b/rust/cloud-storage/authentication_service/src/api/merge/create_merge_request.rs
@@ -103,7 +103,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to get user macro id",
+ message: "failed to get user macro id".into(),
}),
)
.into_response()
@@ -121,7 +121,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to create account merge request",
+ message: "failed to create account merge request".into(),
}),
)
.into_response()
@@ -134,7 +134,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to get user profile",
+ message: "failed to get user profile".into(),
}),
)
.into_response()
@@ -158,7 +158,7 @@ pub async fn handler(
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to send email",
+ message: "failed to send email".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/authentication_service/src/api/merge/verify_merge_request.rs b/rust/cloud-storage/authentication_service/src/api/merge/verify_merge_request.rs
index a66d7bdbd5..ac766fa8a2 100644
--- a/rust/cloud-storage/authentication_service/src/api/merge/verify_merge_request.rs
+++ b/rust/cloud-storage/authentication_service/src/api/merge/verify_merge_request.rs
@@ -58,7 +58,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "account merge request not found",
+ message: "account merge request not found".into(),
}),
)
.into_response()
@@ -67,7 +67,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to get account merge request",
+ message: "failed to get account merge request".into(),
}),
)
.into_response()
@@ -99,7 +99,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to begin transaction",
+ message: "failed to begin transaction".into(),
}),
)
.into_response()
@@ -117,7 +117,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to merge accounts",
+ message: "failed to merge accounts".into(),
}),
)
.into_response()
@@ -180,7 +180,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to commit transaction",
+ message: "failed to commit transaction".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/middleware/has_payment_source.rs b/rust/cloud-storage/authentication_service/src/api/middleware/has_payment_source.rs
index 8a512ee895..ab2289bd97 100644
--- a/rust/cloud-storage/authentication_service/src/api/middleware/has_payment_source.rs
+++ b/rust/cloud-storage/authentication_service/src/api/middleware/has_payment_source.rs
@@ -47,7 +47,7 @@ pub enum StripeCustomerError {
impl IntoResponse for StripeCustomerError {
fn into_response(self) -> Response {
let err = Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
});
match self {
StripeCustomerError::NoStripeCustomerId => (StatusCode::UNAUTHORIZED, err),
diff --git a/rust/cloud-storage/authentication_service/src/api/middleware/team_access.rs b/rust/cloud-storage/authentication_service/src/api/middleware/team_access.rs
index 459dec4882..a0ef1b4ff9 100644
--- a/rust/cloud-storage/authentication_service/src/api/middleware/team_access.rs
+++ b/rust/cloud-storage/authentication_service/src/api/middleware/team_access.rs
@@ -65,7 +65,7 @@ pub enum RoleAccessErr {
impl IntoResponse for RoleAccessErr {
fn into_response(self) -> Response {
let err = Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
});
match self {
RoleAccessErr::MissingTeamId => (StatusCode::BAD_REQUEST, err),
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth/oauth_redirect.rs b/rust/cloud-storage/authentication_service/src/api/oauth/oauth_redirect.rs
index 19ee9efda2..612198b1e4 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth/oauth_redirect.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth/oauth_redirect.rs
@@ -131,21 +131,21 @@ impl IntoResponse for InnerErr {
InnerErr::InvalidJwtError => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to deserialize jwt",
+ message: "failed to deserialize jwt".into(),
}),
)
.into_response(),
InnerErr::Serde(_error) => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "failed to deserialize input",
+ message: "failed to deserialize input".into(),
}),
)
.into_response(),
InnerErr::MacroCacheErr(_e) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to store session code",
+ message: "unable to store session code".into(),
}),
)
.into_response(),
@@ -153,7 +153,7 @@ impl IntoResponse for InnerErr {
InnerErr::ParseErr(_e) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to parse original url",
+ message: "unable to parse original url".into(),
}),
)
.into_response(),
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth/passwordless_callback.rs b/rust/cloud-storage/authentication_service/src/api/oauth/passwordless_callback.rs
index 5a648ab1e6..8d9d0c5f0d 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth/passwordless_callback.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth/passwordless_callback.rs
@@ -81,7 +81,7 @@ pub async fn handler(
FusionAuthClientError::IncorrectCode => (
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "invalid code",
+ message: "invalid code".into(),
}),
)
.into_response(),
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth2/github.rs b/rust/cloud-storage/authentication_service/src/api/oauth2/github.rs
index d7510249b9..8da3df3257 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth2/github.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth2/github.rs
@@ -30,7 +30,7 @@ pub enum GithubLinkError {
impl IntoResponse for GithubLinkError {
fn into_response(self) -> Response {
Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
})
.into_response()
}
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth2/google.rs b/rust/cloud-storage/authentication_service/src/api/oauth2/google.rs
index 37dbef1ab9..3454f2b974 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth2/google.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth2/google.rs
@@ -141,7 +141,13 @@ pub(in crate::api::oauth2) async fn handler(
.await
.map_err(|(status_code, error)| {
tracing::error!(error=?error, "unable to link user");
- (status_code, Json(ErrorResponse { message: &error })).into_response()
+ (
+ status_code,
+ Json(ErrorResponse {
+ message: error.into(),
+ }),
+ )
+ .into_response()
})?;
// Early exit, we don't actually log the user into fusionauth
return Ok(StatusCode::OK.into_response());
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth2/login.rs b/rust/cloud-storage/authentication_service/src/api/oauth2/login.rs
index c55649bad9..d11bd91db8 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth2/login.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth2/login.rs
@@ -58,7 +58,7 @@ pub(in crate::api::oauth2) async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "unable to decode original url",
+ message: "unable to decode original url".into(),
}),
)
.into_response()
@@ -70,7 +70,7 @@ pub(in crate::api::oauth2) async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "unable to parse to original url",
+ message: "unable to parse to original url".into(),
}),
)
.into_response()
@@ -91,7 +91,7 @@ pub(in crate::api::oauth2) async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to store session code",
+ message: "unable to store session code".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth2/mod.rs b/rust/cloud-storage/authentication_service/src/api/oauth2/mod.rs
index 9d1984bbac..f842afcda1 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth2/mod.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth2/mod.rs
@@ -87,7 +87,7 @@ pub(in crate::api) async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "unable to deserialize state",
+ message: "unable to deserialize state".into(),
}),
)
.into_response()
@@ -102,7 +102,7 @@ pub(in crate::api) async fn handler(
_ => Err((
StatusCode::NOT_IMPLEMENTED,
Json(ErrorResponse {
- message: "oauth2 callback not implemented for this provider",
+ message: "oauth2 callback not implemented for this provider".into(),
}),
)
.into_response()),
diff --git a/rust/cloud-storage/authentication_service/src/api/session/session_creation.rs b/rust/cloud-storage/authentication_service/src/api/session/session_creation.rs
index d4023dcae0..68d527882b 100644
--- a/rust/cloud-storage/authentication_service/src/api/session/session_creation.rs
+++ b/rust/cloud-storage/authentication_service/src/api/session/session_creation.rs
@@ -40,7 +40,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to store session code",
+ message: "unable to store session code".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/session/session_login.rs b/rust/cloud-storage/authentication_service/src/api/session/session_login.rs
index 4f470986ae..63dab09ed0 100644
--- a/rust/cloud-storage/authentication_service/src/api/session/session_login.rs
+++ b/rust/cloud-storage/authentication_service/src/api/session/session_login.rs
@@ -50,7 +50,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get session code",
+ message: "unable to get session code".into(),
}),
)
.into_response()
@@ -60,7 +60,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid session code",
+ message: "invalid session code".into(),
}),
)
.into_response());
@@ -72,11 +72,11 @@ pub async fn handler(
.refresh_token("", &refresh_token)
.await
.map_err(|e| {
- tracing::error!(error=?e, refresh_token=?refresh_token, "unable to refresh token");
+ tracing::error!(error=?e, "unable to refresh token");
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to refresh token",
+ message: "unable to refresh token".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/team/create_team.rs b/rust/cloud-storage/authentication_service/src/api/team/create_team.rs
index 82908a0e7a..7126b12a33 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/create_team.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/create_team.rs
@@ -43,7 +43,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid macro user id",
+ message: "invalid macro user id".into(),
}),
)
.into_response()
@@ -57,7 +57,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to create team",
+ message: "unable to create team".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/team/delete_team.rs b/rust/cloud-storage/authentication_service/src/api/team/delete_team.rs
index b26273effe..13683d8da8 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/delete_team.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/delete_team.rs
@@ -31,19 +31,19 @@ impl IntoResponse for DeleteTeamHandlerError {
DeleteTeamError::TeamError(_) | DeleteTeamError::StorageLayerError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to delete team",
+ message: "unable to delete team".into(),
}),
),
DeleteTeamError::RemoveRolesFromUserError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "invalid roles provided",
+ message: "invalid roles provided".into(),
}),
),
DeleteTeamError::CustomerError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to delete team subscription",
+ message: "unable to delete team subscription".into(),
}),
),
},
diff --git a/rust/cloud-storage/authentication_service/src/api/team/delete_team_invite.rs b/rust/cloud-storage/authentication_service/src/api/team/delete_team_invite.rs
index 07657235d2..702d827001 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/delete_team_invite.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/delete_team_invite.rs
@@ -36,13 +36,13 @@ impl IntoResponse for DeleteTeamInviteError {
RemoveTeamInviteError::TeamInviteDoesNotExist => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "team invite does not exist",
+ message: "team invite does not exist".into(),
}),
),
RemoveTeamInviteError::UserNotInTeam => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "user not in team",
+ message: "user not in team".into(),
}),
),
RemoveTeamInviteError::StorageLayerError(_)
@@ -50,7 +50,7 @@ impl IntoResponse for DeleteTeamInviteError {
| RemoveTeamInviteError::TeamError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to delete team invite",
+ message: "unable to delete team invite".into(),
}),
),
},
diff --git a/rust/cloud-storage/authentication_service/src/api/team/get_team.rs b/rust/cloud-storage/authentication_service/src/api/team/get_team.rs
index c7aa3e25d2..476448fc77 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/get_team.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/get_team.rs
@@ -48,7 +48,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get team",
+ message: "unable to get team".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/team/get_team_invites.rs b/rust/cloud-storage/authentication_service/src/api/team/get_team_invites.rs
index e14e97982e..ffcf00f7fc 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/get_team_invites.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/get_team_invites.rs
@@ -51,7 +51,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get team invites",
+ message: "unable to get team invites".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/team/get_user_invites.rs b/rust/cloud-storage/authentication_service/src/api/team/get_user_invites.rs
index 71be7497f7..50ec74e9af 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/get_user_invites.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/get_user_invites.rs
@@ -37,7 +37,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get user invites",
+ message: "unable to get user invites".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/team/get_user_teams.rs b/rust/cloud-storage/authentication_service/src/api/team/get_user_teams.rs
index b823030adc..9b53c9a97d 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/get_user_teams.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/get_user_teams.rs
@@ -37,7 +37,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get user teams",
+ message: "unable to get user teams".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/team/invite_to_team.rs b/rust/cloud-storage/authentication_service/src/api/team/invite_to_team.rs
index db82d355d0..639f8bf7a4 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/invite_to_team.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/invite_to_team.rs
@@ -53,26 +53,26 @@ impl IntoResponse for InviteToTeamError {
InviteToTeamError::InvalidEmails => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid emails detected",
+ message: "invalid emails detected".into(),
}),
),
InviteToTeamError::NoValidEmailsProvided => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "no emails provided",
+ message: "no emails provided".into(),
}),
),
InviteToTeamError::InviteUsersToTeamError(e) => match e {
InviteUsersToTeamError::TooManyEmails => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "too many emails",
+ message: "too many emails".into(),
}),
),
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to invite users to team",
+ message: "unable to invite users to team".into(),
}),
),
},
diff --git a/rust/cloud-storage/authentication_service/src/api/team/join_team.rs b/rust/cloud-storage/authentication_service/src/api/team/join_team.rs
index 4a61287183..bead4c797c 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/join_team.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/join_team.rs
@@ -31,7 +31,7 @@ impl IntoResponse for JoinTeamHandlerError {
JoinTeamHandlerError::JoinTeamError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to join team",
+ message: "unable to join team".into(),
}),
)
.into_response(),
diff --git a/rust/cloud-storage/authentication_service/src/api/team/patch_team.rs b/rust/cloud-storage/authentication_service/src/api/team/patch_team.rs
index 3edc68d554..71ce83765a 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/patch_team.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/patch_team.rs
@@ -53,7 +53,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to update team",
+ message: "unable to update team".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/team/reinvite_to_team.rs b/rust/cloud-storage/authentication_service/src/api/team/reinvite_to_team.rs
index e9b3cd5f31..82ec61f9d1 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/reinvite_to_team.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/reinvite_to_team.rs
@@ -70,7 +70,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get team invite",
+ message: "unable to get team invite".into(),
}),
)
.into_response()
@@ -79,12 +79,12 @@ pub async fn handler(
if team_invite
.last_sent_at
.naive_utc()
- .lt(&(chrono::Utc::now().naive_utc() - chrono::Duration::minutes(5)))
+ .ge(&(chrono::Utc::now().naive_utc() - chrono::Duration::minutes(5)))
{
return Err((
StatusCode::TOO_MANY_REQUESTS,
Json(ErrorResponse {
- message: "team invite has not been sent in the last 5 minutes",
+ message: "team invite was already sent within the last 5 minutes".into(),
}),
)
.into_response());
@@ -97,7 +97,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to update team invite last sent at",
+ message: "unable to update team invite last sent at".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/team/reject_invitation.rs b/rust/cloud-storage/authentication_service/src/api/team/reject_invitation.rs
index 0cf88f7d25..45f13ef2af 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/reject_invitation.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/reject_invitation.rs
@@ -30,13 +30,13 @@ impl IntoResponse for RejectInvitationError {
RemoveTeamInviteError::TeamInviteDoesNotExist => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "team invite does not exist",
+ message: "team invite does not exist".into(),
}),
),
RemoveTeamInviteError::UserNotInTeam => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "user not in team",
+ message: "user not in team".into(),
}),
),
RemoveTeamInviteError::StorageLayerError(_)
@@ -44,7 +44,7 @@ impl IntoResponse for RejectInvitationError {
| RemoveTeamInviteError::TeamError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to reject invitation",
+ message: "unable to reject invitation".into(),
}),
),
},
diff --git a/rust/cloud-storage/authentication_service/src/api/team/remove_user_from_team.rs b/rust/cloud-storage/authentication_service/src/api/team/remove_user_from_team.rs
index 2913106321..49c904702d 100644
--- a/rust/cloud-storage/authentication_service/src/api/team/remove_user_from_team.rs
+++ b/rust/cloud-storage/authentication_service/src/api/team/remove_user_from_team.rs
@@ -13,6 +13,7 @@ use model::{
tracking::IPContext,
};
use model_user::axum_extractor::MacroUserExtractor;
+use macro_user_id::user_id::MacroUserIdStr;
use teams::domain::{model::RemoveUserFromTeamError, team_repo::TeamService};
#[derive(serde::Deserialize)]
@@ -25,6 +26,8 @@ pub struct Param {
pub enum RemoveFromTeamError {
#[error("unable to remove user from team")]
RemoveUserFromTeamError(#[from] RemoveUserFromTeamError),
+ #[error("invalid user id")]
+ InvalidUserId,
}
impl IntoResponse for RemoveFromTeamError {
@@ -34,31 +37,31 @@ impl IntoResponse for RemoveFromTeamError {
RemoveUserFromTeamError::TeamDoesNotExist => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "team does not exist",
+ message: "team does not exist".into(),
}),
),
RemoveUserFromTeamError::RemoveRolesFromUserError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to remove roles from user",
+ message: "unable to remove roles from user".into(),
}),
),
RemoveUserFromTeamError::NoSubscription => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "no subscription",
+ message: "no subscription".into(),
}),
),
RemoveUserFromTeamError::CannotRemoveOwner => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "cannot remove owner",
+ message: "cannot remove owner".into(),
}),
),
RemoveUserFromTeamError::UserNotInTeam => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "user not in team",
+ message: "user not in team".into(),
}),
),
RemoveUserFromTeamError::StorageLayerError(_)
@@ -66,10 +69,16 @@ impl IntoResponse for RemoveFromTeamError {
| RemoveUserFromTeamError::TeamError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to remove user from team",
+ message: "unable to remove user from team".into(),
}),
),
},
+ RemoveFromTeamError::InvalidUserId => (
+ StatusCode::BAD_REQUEST,
+ Json(ErrorResponse {
+ message: "invalid user id".into(),
+ }),
+ ),
}
.into_response()
}
@@ -105,8 +114,11 @@ pub async fn handler(
) -> Result<(StatusCode, Json<EmptyResponse>), RemoveFromTeamError> {
tracing::info!("remove_user_from_team");
+ let remove_user_id = MacroUserIdStr::try_from(remove_user_id)
+ .map_err(|_| RemoveFromTeamError::InvalidUserId)?;
+
ctx.teams_service
- .remove_user_from_team(&team_id, &user_context.macro_user_id)
+ .remove_user_from_team(&team_id, &remove_user_id)
.await?;
Ok((StatusCode::OK, Json(EmptyResponse::default())))
diff --git a/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs b/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs
index 574fcca3de..d19b931a3b 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs
@@ -66,13 +66,13 @@ impl IntoResponse for GetLegacyUserPermissionsError {
GetLegacyUserPermissionsError::InternalError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal error",
+ message: "internal error".into(),
}),
),
GetLegacyUserPermissionsError::InvalidMacroUserId => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid user id",
+ message: "invalid user id".into(),
}),
),
}
diff --git a/rust/cloud-storage/authentication_service/src/api/user/get_user_info.rs b/rust/cloud-storage/authentication_service/src/api/user/get_user_info.rs
index 2b7b286345..88fd97d65f 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/get_user_info.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/get_user_info.rs
@@ -37,7 +37,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get user permissions",
+ message: "unable to get user permissions".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs b/rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs
index 195e9c442d..caf58099e2 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs
@@ -58,7 +58,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get identity provider id by name",
+ message: "unable to get identity provider id by name".into(),
}),
)
.into_response()
@@ -68,7 +68,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "missing idp_name or idp_id",
+ message: "missing idp_name or idp_id".into(),
}),
)
.into_response());
@@ -85,7 +85,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch links",
+ message: "unable to fetch links".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/authentication_service/src/api/user/get_user_organization.rs b/rust/cloud-storage/authentication_service/src/api/user/get_user_organization.rs
index b00fbdda0c..75b1fa6eff 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/get_user_organization.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/get_user_organization.rs
@@ -29,7 +29,7 @@ impl IntoResponse for UserOrganizationError {
UserOrganizationError::InternalError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal error",
+ message: "internal error".into(),
}),
),
}
diff --git a/rust/cloud-storage/authentication_service/src/api/user/get_user_quota.rs b/rust/cloud-storage/authentication_service/src/api/user/get_user_quota.rs
index 85c0eac2c2..7656dd8414 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/get_user_quota.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/get_user_quota.rs
@@ -43,7 +43,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to parse user id",
+ message: "unable to parse user id".into(),
}),
)
.into_response()
@@ -62,7 +62,7 @@ pub async fn handler(
Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "no permissions were found for user",
+ message: "no permissions were found for user".into(),
}),
)
.into_response())
diff --git a/rust/cloud-storage/authentication_service/src/api/user/patch_ai_consent.rs b/rust/cloud-storage/authentication_service/src/api/user/patch_ai_consent.rs
index 975f62aa8c..bf388336f7 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/patch_ai_consent.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/patch_ai_consent.rs
@@ -37,19 +37,19 @@ impl IntoResponse for PatchAiConsentError {
PatchAiConsentError::UserNotFound => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "user not found",
+ message: "user not found".into(),
}),
),
PatchAiConsentError::InvalidMacroUserId => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid user id",
+ message: "invalid user id".into(),
}),
),
PatchAiConsentError::InternalError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal error",
+ message: "internal error".into(),
}),
),
}
diff --git a/rust/cloud-storage/authentication_service/src/api/user/patch_tutorial.rs b/rust/cloud-storage/authentication_service/src/api/user/patch_tutorial.rs
index a4460641c8..edb25fd352 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/patch_tutorial.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/patch_tutorial.rs
@@ -37,19 +37,19 @@ impl IntoResponse for PatchTutorialCompleteError {
PatchTutorialCompleteError::UserNotFound => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "user not found",
+ message: "user not found".into(),
}),
),
PatchTutorialCompleteError::InvalidMacroUserId => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid user id",
+ message: "invalid user id".into(),
}),
),
PatchTutorialCompleteError::InternalError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal error",
+ message: "internal error".into(),
}),
),
}
diff --git a/rust/cloud-storage/authentication_service/src/api/user/patch_user_group.rs b/rust/cloud-storage/authentication_service/src/api/user/patch_user_group.rs
index 30501f7035..5199fab9ab 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/patch_user_group.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/patch_user_group.rs
@@ -36,19 +36,19 @@ impl IntoResponse for PatchUserGroupError {
PatchUserGroupError::UserNotFound => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "user not found",
+ message: "user not found".into(),
}),
),
PatchUserGroupError::InvalidMacroUserId => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid user id",
+ message: "invalid user id".into(),
}),
),
PatchUserGroupError::InternalError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal error",
+ message: "internal error".into(),
}),
),
}
diff --git a/rust/cloud-storage/authentication_service/src/api/user/patch_user_onboarding.rs b/rust/cloud-storage/authentication_service/src/api/user/patch_user_onboarding.rs
index 4273179fee..c800bb2b1e 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/patch_user_onboarding.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/patch_user_onboarding.rs
@@ -43,19 +43,19 @@ impl IntoResponse for PatchUserOnboardingError {
PatchUserOnboardingError::UserNotFound => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "user not found",
+ message: "user not found".into(),
}),
),
PatchUserOnboardingError::InvalidMacroUserId => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid user id",
+ message: "invalid user id".into(),
}),
),
PatchUserOnboardingError::InternalError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal error",
+ message: "internal error".into(),
}),
),
}
diff --git a/rust/cloud-storage/authentication_service/src/api/webhooks/user/stripe_webhook.rs b/rust/cloud-storage/authentication_service/src/api/webhooks/user/stripe_webhook.rs
index 460f9ddba8..2c1958ef05 100644
--- a/rust/cloud-storage/authentication_service/src/api/webhooks/user/stripe_webhook.rs
+++ b/rust/cloud-storage/authentication_service/src/api/webhooks/user/stripe_webhook.rs
@@ -37,7 +37,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "Missing Stripe-Signature header",
+ message: "Missing Stripe-Signature header".into(),
}),
)
.into_response()
@@ -48,7 +48,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "Invalid webhook payload encoding",
+ message: "Invalid webhook payload encoding".into(),
}),
)
.into_response()
@@ -65,7 +65,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "failed to construct stripe event",
+ message: "failed to construct stripe event".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/channels/src/inbound/axum_router.rs b/rust/cloud-storage/channels/src/inbound/axum_router.rs
index 1902165961..0f388a4d67 100644
--- a/rust/cloud-storage/channels/src/inbound/axum_router.rs
+++ b/rust/cloud-storage/channels/src/inbound/axum_router.rs
@@ -625,16 +625,20 @@ pub enum ChannelsHandlerErr {
impl IntoResponse for ChannelsHandlerErr {
fn into_response(self) -> axum::response::Response {
match self {
- ChannelsHandlerErr::BadRequest(message) => {
- (StatusCode::BAD_REQUEST, Json(ErrorResponse { message })).into_response()
- }
+ ChannelsHandlerErr::BadRequest(message) => (
+ StatusCode::BAD_REQUEST,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response(),
ChannelsHandlerErr::Internal(err) => match err {
ChannelMessagesErr::MessageNotFound(id) => {
tracing::warn!(message_id=?id, "message not found");
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "Message not found",
+ message: "Message not found".into(),
}),
)
.into_response()
@@ -644,7 +648,7 @@ impl IntoResponse for ChannelsHandlerErr {
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "An internal server error occurred",
+ message: "An internal server error occurred".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/convert_service/src/api/backfill/backfill_docx.rs b/rust/cloud-storage/convert_service/src/api/backfill/backfill_docx.rs
index 5fba2b2839..f66985adc7 100644
--- a/rust/cloud-storage/convert_service/src/api/backfill/backfill_docx.rs
+++ b/rust/cloud-storage/convert_service/src/api/backfill/backfill_docx.rs
@@ -55,7 +55,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get documents",
+ message: "unable to get documents".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/convert_service/src/api/convert.rs b/rust/cloud-storage/convert_service/src/api/convert.rs
index ee5aa1c34f..06b4ee0e36 100644
--- a/rust/cloud-storage/convert_service/src/api/convert.rs
+++ b/rust/cloud-storage/convert_service/src/api/convert.rs
@@ -61,7 +61,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get file type",
+ message: "unable to get file type".into(),
}),
)
.into_response()
@@ -78,7 +78,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get file type",
+ message: "unable to get file type".into(),
}),
)
.into_response()
@@ -89,7 +89,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: &e.to_string(),
+ message: e.to_string().into(),
}),
)
.into_response()
@@ -105,7 +105,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get object from S3",
+ message: "unable to get object from S3".into(),
}),
)
.into_response()
@@ -116,7 +116,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to create directory",
+ message: "unable to create directory".into(),
}),
)
.into_response()
@@ -128,7 +128,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to create file",
+ message: "unable to create file".into(),
}),
)
.into_response()
@@ -139,7 +139,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to write file",
+ message: "unable to write file".into(),
}),
)
.into_response()
@@ -189,7 +189,7 @@ pub async fn handler(
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "fork failed",
+ message: "fork failed".into(),
}),
)
.into_response());
@@ -232,7 +232,7 @@ pub async fn handler(
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "conversion failed",
+ message: "conversion failed".into(),
}),
)
.into_response());
@@ -243,7 +243,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to read file",
+ message: "unable to read file".into(),
}),
)
.into_response()
@@ -257,7 +257,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to upload file",
+ message: "unable to upload file".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/create_anchor.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/create_anchor.rs
index 84bd78c42d..472eb16626 100644
--- a/rust/cloud-storage/document_storage_service/src/api/annotations/create_anchor.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/create_anchor.rs
@@ -59,7 +59,7 @@ pub async fn create_anchor_handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "cannot modify deleted document",
+ message: "cannot modify deleted document".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/create_comment.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/create_comment.rs
index 1c3aea766b..36f8b763fd 100644
--- a/rust/cloud-storage/document_storage_service/src/api/annotations/create_comment.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/create_comment.rs
@@ -65,7 +65,7 @@ pub async fn create_comment_handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "cannot modify deleted document",
+ message: "cannot modify deleted document".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/get.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/get.rs
index fc55abe39f..1e2560ac6c 100644
--- a/rust/cloud-storage/document_storage_service/src/api/annotations/get.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/get.rs
@@ -92,7 +92,7 @@ pub async fn get_document_anchors_handler(
_ => Err((
StatusCode::METHOD_NOT_ALLOWED,
Json(ErrorResponse {
- message: "Unsupported file type",
+ message: "Unsupported file type".into(),
}),
)
.into_response()),
diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/mod.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/mod.rs
index 32c4a3b0e1..331b862ce8 100644
--- a/rust/cloud-storage/document_storage_service/src/api/annotations/mod.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/mod.rs
@@ -82,34 +82,36 @@ pub fn comment_error_response(e: anyhow::Error, default_msg: &str) -> Result<Res
Some(CommentError::CommentNotFound) => Err((
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: e.to_string().as_ref(),
+ message: e.to_string().into(),
}),
)
.into_response()),
Some(CommentError::ThreadNotFound) => Err((
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: e.to_string().as_ref(),
+ message: e.to_string().into(),
}),
)
.into_response()),
Some(CommentError::AnchorNotFound) => Err((
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: e.to_string().as_ref(),
+ message: e.to_string().into(),
}),
)
.into_response()),
Some(CommentError::InvalidPermissions) => Err((
StatusCode::FORBIDDEN,
Json(ErrorResponse {
- message: e.to_string().as_ref(),
+ message: e.to_string().into(),
}),
)
.into_response()),
Some(CommentError::NotAllowed(msg)) => Err((
StatusCode::METHOD_NOT_ALLOWED,
- Json(ErrorResponse { message: msg }),
+ Json(ErrorResponse {
+ message: msg.into(),
+ }),
)
.into_response()),
None => {
@@ -117,7 +119,7 @@ pub fn comment_error_response(e: anyhow::Error, default_msg: &str) -> Result<Res
Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: default_msg,
+ message: default_msg.into(),
}),
)
.into_response())
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/copy_document/mod.rs b/rust/cloud-storage/document_storage_service/src/api/documents/copy_document/mod.rs
index deba32c0b3..35cd67db01 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/copy_document/mod.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/copy_document/mod.rs
@@ -66,7 +66,7 @@ pub(in crate::api) async fn copy_document_handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "cannot copy deleted document",
+ message: "cannot copy deleted document".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/delete_document.rs b/rust/cloud-storage/document_storage_service/src/api/documents/delete_document.rs
index 6dca09d999..dd79798a87 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/delete_document.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/delete_document.rs
@@ -58,7 +58,7 @@ pub async fn permanently_delete_document_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get bom parts",
+ message: "unable to get bom parts".into(),
}),
)
.into_response()
@@ -82,7 +82,7 @@ pub async fn permanently_delete_document_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to decrement sha ref counts",
+ message: "unable to decrement sha ref counts".into(),
}),
)
.into_response()
@@ -97,7 +97,7 @@ pub async fn permanently_delete_document_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to delete document",
+ message: "unable to delete document".into(),
}),
)
.into_response()
@@ -123,7 +123,7 @@ pub async fn permanently_delete_document_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to enqueue document delete",
+ message: "unable to enqueue document delete".into(),
}),
)
.into_response()
@@ -140,7 +140,7 @@ pub async fn permanently_delete_document_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to send message to search extractor queue",
+ message: "unable to send message to search extractor queue".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/export_document.rs b/rust/cloud-storage/document_storage_service/src/api/documents/export_document.rs
index cfc7c62358..d5f1bced00 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/export_document.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/export_document.rs
@@ -74,7 +74,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to convert file type",
+ message: "unable to convert file type".into(),
}),
)
.into_response()
@@ -97,7 +97,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to export document",
+ message: "unable to export document".into(),
}),
)
.into_response()
@@ -114,7 +114,7 @@ pub async fn handler(
Ok((
StatusCode::NOT_IMPLEMENTED,
Json(ErrorResponse {
- message: "cannot export document with no file type",
+ message: "cannot export document with no file type".into(),
}),
)
.into_response())
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/initialize_user_documents.rs b/rust/cloud-storage/document_storage_service/src/api/documents/initialize_user_documents.rs
index 6f16b3fdee..fbf9848356 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/initialize_user_documents.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/initialize_user_documents.rs
@@ -50,7 +50,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to get folder content names",
+ message: "failed to get folder content names".into(),
}),
)
.into_response()
@@ -67,7 +67,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to start transaction",
+ message: "unable to start transaction".into(),
}),
)
.into_response()
@@ -91,7 +91,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to create project",
+ message: "failed to create project".into(),
}),
)
.into_response()
@@ -114,7 +114,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to create onboarding documents",
+ message: "failed to create onboarding documents".into(),
}),
)
.into_response()
@@ -128,7 +128,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to fill markdown template",
+ message: "failed to fill markdown template".into(),
}),
)
.into_response()
@@ -140,7 +140,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to fill canvas template",
+ message: "failed to fill canvas template".into(),
}),
)
.into_response()
@@ -205,7 +205,7 @@ pub async fn handler(
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to copy documents",
+ message: "failed to copy documents".into(),
}),
)
.into_response());
@@ -224,7 +224,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to set onboarding status",
+ message: "failed to set onboarding status".into(),
}),
)
.into_response()
@@ -238,7 +238,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to commit transaction",
+ message: "failed to commit transaction".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/permissions_token/create_permission_token.rs b/rust/cloud-storage/document_storage_service/src/api/documents/permissions_token/create_permission_token.rs
index 113d95ee65..1cb2cb0b8d 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/permissions_token/create_permission_token.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/permissions_token/create_permission_token.rs
@@ -81,7 +81,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to encode jwt",
+ message: "unable to encode jwt".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/permissions_token/validate_permissions_token.rs b/rust/cloud-storage/document_storage_service/src/api/documents/permissions_token/validate_permissions_token.rs
index 3d6debd2ba..183b374896 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/permissions_token/validate_permissions_token.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/permissions_token/validate_permissions_token.rs
@@ -62,7 +62,7 @@ pub async fn handler(
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "jwt is expired",
+ message: "jwt is expired".into(),
}),
)
.into_response());
@@ -71,7 +71,7 @@ pub async fn handler(
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "unable to decode jwt",
+ message: "unable to decode jwt".into(),
}),
)
.into_response());
@@ -83,7 +83,7 @@ pub async fn handler(
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "jwt user id does not match user id",
+ message: "jwt user id does not match user id".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/save_document/save_document_handler.rs b/rust/cloud-storage/document_storage_service/src/api/documents/save_document/save_document_handler.rs
index a7af60f788..e26a5b32aa 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/save_document/save_document_handler.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/save_document/save_document_handler.rs
@@ -63,7 +63,7 @@ pub async fn save_document_handler(
return (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "cannot modify deleted document",
+ message: "cannot modify deleted document".into(),
}),
)
.into_response();
diff --git a/rust/cloud-storage/document_storage_service/src/api/permissions/update_user_channel_permissions.rs b/rust/cloud-storage/document_storage_service/src/api/permissions/update_user_channel_permissions.rs
index 259a31c2ea..fefb853222 100644
--- a/rust/cloud-storage/document_storage_service/src/api/permissions/update_user_channel_permissions.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/permissions/update_user_channel_permissions.rs
@@ -22,7 +22,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "invalid channel id format",
+ message: "invalid channel id format".into(),
}),
)
.into_response()
@@ -38,7 +38,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to add permissions for channel users",
+ message: "failed to add permissions for channel users".into(),
}),
)
.into_response()
@@ -52,7 +52,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to remove permissions for channel users",
+ message: "failed to remove permissions for channel users".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/document_storage_service/src/api/projects/edit_project.rs b/rust/cloud-storage/document_storage_service/src/api/projects/edit_project.rs
index 5f8f951ef2..d60a4c8d28 100644
--- a/rust/cloud-storage/document_storage_service/src/api/projects/edit_project.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/projects/edit_project.rs
@@ -61,7 +61,7 @@ pub async fn edit_project_handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "cannot modify deleted project",
+ message: "cannot modify deleted project".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/document_storage_service/src/api/projects/get_project.rs b/rust/cloud-storage/document_storage_service/src/api/projects/get_project.rs
index cea0b4dead..9dd7303c10 100644
--- a/rust/cloud-storage/document_storage_service/src/api/projects/get_project.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/projects/get_project.rs
@@ -53,7 +53,7 @@ pub async fn get_project_content_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get project content",
+ message: "unable to get project content".into(),
}),
)
.into_response()
@@ -91,7 +91,7 @@ pub async fn get_project_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get project",
+ message: "unable to get project".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/document_storage_service/src/api/saved_views.rs b/rust/cloud-storage/document_storage_service/src/api/saved_views.rs
index 05ed9e0fb6..08b70d769b 100644
--- a/rust/cloud-storage/document_storage_service/src/api/saved_views.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/saved_views.rs
@@ -48,7 +48,7 @@ impl IntoResponse for SavedViewErr {
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
}),
)
.into_response()
@@ -56,20 +56,24 @@ impl IntoResponse for SavedViewErr {
SavedViewErr::Unauthorized => (
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
}),
)
.into_response(),
SavedViewErr::NotFound => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
+ }),
+ )
+ .into_response(),
+ SavedViewErr::BadRequest(message) => (
+ StatusCode::BAD_REQUEST,
+ Json(ErrorResponse {
+ message: (*message).into(),
}),
)
.into_response(),
- SavedViewErr::BadRequest(message) => {
- (StatusCode::BAD_REQUEST, Json(ErrorResponse { message })).into_response()
- }
}
}
}
diff --git a/rust/cloud-storage/document_storage_service/src/api/threads/edit_thread.rs b/rust/cloud-storage/document_storage_service/src/api/threads/edit_thread.rs
index 06a1d78bcf..51fd254557 100644
--- a/rust/cloud-storage/document_storage_service/src/api/threads/edit_thread.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/threads/edit_thread.rs
@@ -53,7 +53,7 @@ pub async fn edit_thread_handler(
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "you do not have valid permissions to move this item",
+ message: "you do not have valid permissions to move this item".into(),
}),
)
.into_response());
@@ -63,7 +63,7 @@ pub async fn edit_thread_handler(
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "you do not have valid permission to modify share permissions",
+ message: "you do not have valid permission to modify share permissions".into(),
}),
)
.into_response());
@@ -75,7 +75,7 @@ pub async fn edit_thread_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to edit thread",
+ message: "unable to edit thread".into(),
}),
)
.into_response()
@@ -92,7 +92,7 @@ pub async fn edit_thread_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to update thread share permissions",
+ message: "unable to update thread share permissions".into(),
}),
)
.into_response()
@@ -111,7 +111,7 @@ pub async fn edit_thread_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to update user item access",
+ message: "unable to update user item access".into(),
}),
)
.into_response()
@@ -122,7 +122,7 @@ pub async fn edit_thread_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to edit thread",
+ message: "unable to edit thread".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/documents/src/inbound/axum_router.rs b/rust/cloud-storage/documents/src/inbound/axum_router.rs
index 3cbc9c8c78..f759d99555 100644
--- a/rust/cloud-storage/documents/src/inbound/axum_router.rs
+++ b/rust/cloud-storage/documents/src/inbound/axum_router.rs
@@ -61,7 +61,13 @@ impl IntoResponse for DocumentError {
}
let message = self.to_string();
- (status_code, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status_code,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
@@ -165,7 +171,8 @@ async fn ensure_document_exists<T: DocumentService, Svc: EntityAccessService>(
return (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: &format!("document with id \"{}\" was not found", document_id),
+ message: format!("document with id \"{}\" was not found", document_id)
+ .into(),
}),
)
.into_response();
@@ -176,7 +183,7 @@ async fn ensure_document_exists<T: DocumentService, Svc: EntityAccessService>(
return (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unknown error occurred",
+ message: "unknown error occurred".into(),
}),
)
.into_response();
diff --git a/rust/cloud-storage/email/src/inbound/axum/draft_router.rs b/rust/cloud-storage/email/src/inbound/axum/draft_router.rs
index 23768f088b..5b4c2ee17a 100644
--- a/rust/cloud-storage/email/src/inbound/axum/draft_router.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/draft_router.rs
@@ -48,7 +48,13 @@ impl IntoResponse for CreateDraftError {
};
let message = self.to_string();
- (status, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/email/src/inbound/axum/email_filter_router.rs b/rust/cloud-storage/email/src/inbound/axum/email_filter_router.rs
index da04b94aaa..40f9fbfddf 100644
--- a/rust/cloud-storage/email/src/inbound/axum/email_filter_router.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/email_filter_router.rs
@@ -94,7 +94,13 @@ impl IntoResponse for EmailFilterError {
};
let message = self.to_string();
- (status, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/email/src/inbound/axum/get_thread_router.rs b/rust/cloud-storage/email/src/inbound/axum/get_thread_router.rs
index e74563a29f..236162dc94 100644
--- a/rust/cloud-storage/email/src/inbound/axum/get_thread_router.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/get_thread_router.rs
@@ -76,7 +76,13 @@ impl IntoResponse for GetThreadError {
};
let message = self.to_string();
- (status, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/email/src/inbound/axum/list_labels_router.rs b/rust/cloud-storage/email/src/inbound/axum/list_labels_router.rs
index a7e948656a..d8ffea1298 100644
--- a/rust/cloud-storage/email/src/inbound/axum/list_labels_router.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/list_labels_router.rs
@@ -27,7 +27,9 @@ impl IntoResponse for ListLabelsError {
let message = self.to_string();
(
StatusCode::INTERNAL_SERVER_ERROR,
- Json(ErrorResponse { message: &message }),
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
)
.into_response()
}
diff --git a/rust/cloud-storage/email/src/inbound/axum/send_router.rs b/rust/cloud-storage/email/src/inbound/axum/send_router.rs
index 5e5f69f609..7858463015 100644
--- a/rust/cloud-storage/email/src/inbound/axum/send_router.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/send_router.rs
@@ -48,7 +48,13 @@ impl IntoResponse for SendMessageError {
};
let message = self.to_string();
- (status, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/email/src/inbound/axum/thread_labels_router.rs b/rust/cloud-storage/email/src/inbound/axum/thread_labels_router.rs
index b0db89237c..90849ea7ef 100644
--- a/rust/cloud-storage/email/src/inbound/axum/thread_labels_router.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/thread_labels_router.rs
@@ -57,7 +57,13 @@ impl IntoResponse for UpdateThreadLabelError {
};
let message = self.to_string();
- (status, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/email/src/inbound/axum/thread_project_router.rs b/rust/cloud-storage/email/src/inbound/axum/thread_project_router.rs
index e45d71bd08..2e88237024 100644
--- a/rust/cloud-storage/email/src/inbound/axum/thread_project_router.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/thread_project_router.rs
@@ -56,7 +56,13 @@ impl IntoResponse for UpdateThreadProjectError {
};
let message = self.to_string();
- (status, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/email_service/src/api/email/attachments/get.rs b/rust/cloud-storage/email_service/src/api/email/attachments/get.rs
index fd18f45ec5..e22d117e31 100644
--- a/rust/cloud-storage/email_service/src/api/email/attachments/get.rs
+++ b/rust/cloud-storage/email_service/src/api/email/attachments/get.rs
@@ -59,7 +59,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error fetching attachment",
+ message: "error fetching attachment".into(),
}),
)
.into_response()
@@ -73,7 +73,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "attachment does not exist",
+ message: "attachment does not exist".into(),
}),
)
.into_response()
@@ -105,7 +105,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error fetching attachment",
+ message: "error fetching attachment".into(),
}),
)
.into_response()
@@ -127,7 +127,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error fetching attachment",
+ message: "error fetching attachment".into(),
}),
)
.into_response()
@@ -148,7 +148,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error uploading attachment",
+ message: "error uploading attachment".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/backfill/cancel.rs b/rust/cloud-storage/email_service/src/api/email/backfill/cancel.rs
index e6834d0239..f166b83ddc 100644
--- a/rust/cloud-storage/email_service/src/api/email/backfill/cancel.rs
+++ b/rust/cloud-storage/email_service/src/api/email/backfill/cancel.rs
@@ -49,7 +49,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error fetching job",
+ message: "error fetching job".into(),
}),
)
.into_response()
@@ -63,7 +63,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "job does not exist",
+ message: "job does not exist".into(),
}),
)
.into_response()
@@ -73,21 +73,21 @@ pub async fn handler(
BackfillJobStatus::Cancelled => Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "job already cancelled",
+ message: "job already cancelled".into(),
}),
)
.into_response()),
BackfillJobStatus::Complete => Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "job already completed",
+ message: "job already completed".into(),
}),
)
.into_response()),
BackfillJobStatus::Failed => Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "job already failed",
+ message: "job already failed".into(),
}),
)
.into_response()),
@@ -105,7 +105,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error updating job status",
+ message: "error updating job status".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/backfill/get.rs b/rust/cloud-storage/email_service/src/api/email/backfill/get.rs
index acc2798d45..a59258e548 100644
--- a/rust/cloud-storage/email_service/src/api/email/backfill/get.rs
+++ b/rust/cloud-storage/email_service/src/api/email/backfill/get.rs
@@ -52,7 +52,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error fetching job",
+ message: "error fetching job".into(),
}),
)
.into_response()
@@ -66,7 +66,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "job does not exist",
+ message: "job does not exist".into(),
}),
)
.into_response()
@@ -124,7 +124,7 @@ impl IntoResponse for GetActiveBackfillError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/contacts/block_sender.rs b/rust/cloud-storage/email_service/src/api/email/contacts/block_sender.rs
index 153831270f..1ae4fd6dee 100644
--- a/rust/cloud-storage/email_service/src/api/email/contacts/block_sender.rs
+++ b/rust/cloud-storage/email_service/src/api/email/contacts/block_sender.rs
@@ -41,7 +41,7 @@ impl IntoResponse for BlockSenderError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/contacts/list.rs b/rust/cloud-storage/email_service/src/api/email/contacts/list.rs
index 7f7de2e392..11d196aa39 100644
--- a/rust/cloud-storage/email_service/src/api/email/contacts/list.rs
+++ b/rust/cloud-storage/email_service/src/api/email/contacts/list.rs
@@ -42,7 +42,7 @@ pub async fn list_contacts_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch links",
+ message: "unable to fetch links".into(),
}),
)
.into_response()
@@ -51,7 +51,7 @@ pub async fn list_contacts_handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "link not found",
+ message: "link not found".into(),
}),
)
.into_response()
@@ -64,7 +64,7 @@ pub async fn list_contacts_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch contacts",
+ message: "unable to fetch contacts".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/contacts/list_blocked.rs b/rust/cloud-storage/email_service/src/api/email/contacts/list_blocked.rs
index 0292ff16b1..d970fb791b 100644
--- a/rust/cloud-storage/email_service/src/api/email/contacts/list_blocked.rs
+++ b/rust/cloud-storage/email_service/src/api/email/contacts/list_blocked.rs
@@ -33,7 +33,7 @@ impl IntoResponse for ListBlockedError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/contacts/unblock_sender.rs b/rust/cloud-storage/email_service/src/api/email/contacts/unblock_sender.rs
index b5735392c8..034b77bf30 100644
--- a/rust/cloud-storage/email_service/src/api/email/contacts/unblock_sender.rs
+++ b/rust/cloud-storage/email_service/src/api/email/contacts/unblock_sender.rs
@@ -41,7 +41,7 @@ impl IntoResponse for UnblockSenderError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/drafts/add_attachment.rs b/rust/cloud-storage/email_service/src/api/email/drafts/add_attachment.rs
index 1ec0d5c6ad..12722f8dab 100644
--- a/rust/cloud-storage/email_service/src/api/email/drafts/add_attachment.rs
+++ b/rust/cloud-storage/email_service/src/api/email/drafts/add_attachment.rs
@@ -38,7 +38,7 @@ impl IntoResponse for AddDraftAttachmentError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/drafts/add_forwarded_attachment.rs b/rust/cloud-storage/email_service/src/api/email/drafts/add_forwarded_attachment.rs
index b2aa04e59c..381c0eca7f 100644
--- a/rust/cloud-storage/email_service/src/api/email/drafts/add_forwarded_attachment.rs
+++ b/rust/cloud-storage/email_service/src/api/email/drafts/add_forwarded_attachment.rs
@@ -33,7 +33,7 @@ impl IntoResponse for AddForwardedAttachmentError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/drafts/remove_attachment.rs b/rust/cloud-storage/email_service/src/api/email/drafts/remove_attachment.rs
index bddbabfd37..024b137783 100644
--- a/rust/cloud-storage/email_service/src/api/email/drafts/remove_attachment.rs
+++ b/rust/cloud-storage/email_service/src/api/email/drafts/remove_attachment.rs
@@ -34,7 +34,7 @@ impl IntoResponse for RemoveDraftAttachmentError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/drafts/remove_forwarded_attachment.rs b/rust/cloud-storage/email_service/src/api/email/drafts/remove_forwarded_attachment.rs
index 4790717ea6..6a2f83cd20 100644
--- a/rust/cloud-storage/email_service/src/api/email/drafts/remove_forwarded_attachment.rs
+++ b/rust/cloud-storage/email_service/src/api/email/drafts/remove_forwarded_attachment.rs
@@ -33,7 +33,7 @@ impl IntoResponse for RemoveForwardedAttachmentError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/list.rs b/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/list.rs
index 8aefb612c4..8d803b7f9c 100644
--- a/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/list.rs
+++ b/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/list.rs
@@ -32,7 +32,7 @@ impl IntoResponse for GetScheduledError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/remove.rs b/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/remove.rs
index c3bafc5736..5ef0350f91 100644
--- a/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/remove.rs
+++ b/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/remove.rs
@@ -37,7 +37,7 @@ impl IntoResponse for DeleteScheduledError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/upsert.rs b/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/upsert.rs
index 658499f8fe..a86796f38e 100644
--- a/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/upsert.rs
+++ b/rust/cloud-storage/email_service/src/api/email/drafts/scheduled/upsert.rs
@@ -36,7 +36,7 @@ impl IntoResponse for UpsertScheduledError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/labels/create.rs b/rust/cloud-storage/email_service/src/api/email/labels/create.rs
index 83b3b24fc5..129b37c14b 100644
--- a/rust/cloud-storage/email_service/src/api/email/labels/create.rs
+++ b/rust/cloud-storage/email_service/src/api/email/labels/create.rs
@@ -54,13 +54,13 @@ pub async fn handler(
gmail_client::GmailError::Conflict(_) => (
StatusCode::CONFLICT,
Json(ErrorResponse {
- message: "label with that name already exists",
+ message: "label with that name already exists".into(),
}),
),
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "create label call failed",
+ message: "create label call failed".into(),
}),
),
}
@@ -74,7 +74,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to insert label",
+ message: "unable to insert label".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/labels/delete.rs b/rust/cloud-storage/email_service/src/api/email/labels/delete.rs
index 8db979c5df..de794bed4c 100644
--- a/rust/cloud-storage/email_service/src/api/email/labels/delete.rs
+++ b/rust/cloud-storage/email_service/src/api/email/labels/delete.rs
@@ -40,7 +40,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch label",
+ message: "unable to fetch label".into(),
}),
)
.into_response()
@@ -49,7 +49,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "Label not found in database.",
+ message: "Label not found in database.".into(),
}),
)
.into_response()
@@ -79,7 +79,7 @@ pub async fn handler(
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "delete label gmail api call failed",
+ message: "delete label gmail api call failed".into(),
}),
)
.into_response());
@@ -95,7 +95,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to delete label from database",
+ message: "unable to delete label from database".into(),
}),
)
.into_response()
@@ -106,7 +106,7 @@ pub async fn handler(
return Err((
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "Label not found in database during deletion.",
+ message: "Label not found in database during deletion.".into(),
}),
)
.into_response());
diff --git a/rust/cloud-storage/email_service/src/api/email/messages/labels.rs b/rust/cloud-storage/email_service/src/api/email/messages/labels.rs
index 7286bc6a69..0861cb4da2 100644
--- a/rust/cloud-storage/email_service/src/api/email/messages/labels.rs
+++ b/rust/cloud-storage/email_service/src/api/email/messages/labels.rs
@@ -60,7 +60,7 @@ pub async fn handler(
message: format!(
"Must include between 1 and {BATCH_UPDATE_MESSAGE_LIMIT} message IDs in request"
)
- .as_str(),
+ .into(),
}),
)
.into_response());
@@ -73,7 +73,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch label from db",
+ message: "unable to fetch label from db".into(),
}),
)
.into_response()
@@ -85,7 +85,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "label not found",
+ message: "label not found".into(),
}),
)
.into_response());
@@ -103,7 +103,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch messages from db",
+ message: "unable to fetch messages from db".into(),
}),
)
.into_response()
@@ -136,7 +136,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to add label to messages",
+ message: "unable to add label to messages".into(),
}),
)
.into_response()
@@ -155,7 +155,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to remove label from messages",
+ message: "unable to remove label from messages".into(),
}),
)
.into_response()
@@ -176,7 +176,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to update message read status",
+ message: "unable to update message read status".into(),
}),
)
.into_response()
@@ -194,7 +194,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to update message starred status",
+ message: "unable to update message starred status".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/email/sync/disable.rs b/rust/cloud-storage/email_service/src/api/email/sync/disable.rs
index b261a41c05..76cb6a2513 100644
--- a/rust/cloud-storage/email_service/src/api/email/sync/disable.rs
+++ b/rust/cloud-storage/email_service/src/api/email/sync/disable.rs
@@ -24,7 +24,13 @@ impl IntoResponse for DisableSyncError {
};
let message = self.to_string();
- (status_code, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status_code,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/email_service/src/api/email/threads/get.rs b/rust/cloud-storage/email_service/src/api/email/threads/get.rs
index 8cf5e7d75b..c448a9207a 100644
--- a/rust/cloud-storage/email_service/src/api/email/threads/get.rs
+++ b/rust/cloud-storage/email_service/src/api/email/threads/get.rs
@@ -40,7 +40,7 @@ impl IntoResponse for GetThreadError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/gmail/webhook.rs b/rust/cloud-storage/email_service/src/api/gmail/webhook.rs
index 85de4153be..eb0cffa500 100644
--- a/rust/cloud-storage/email_service/src/api/gmail/webhook.rs
+++ b/rust/cloud-storage/email_service/src/api/gmail/webhook.rs
@@ -39,7 +39,7 @@ pub async fn webhook_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to enqueue gmail notification",
+ message: "unable to enqueue gmail notification".into(),
}),
)
.into_response()
@@ -61,7 +61,7 @@ pub async fn webhook_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to enqueue gmail notification",
+ message: "unable to enqueue gmail notification".into(),
}),
)
.into_response()
@@ -85,7 +85,7 @@ async fn validate_google_token(ctx: &ApiContext, headers: &HeaderMap) -> Result<
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get google public keys",
+ message: "unable to get google public keys".into(),
}),
)
.into_response()
@@ -97,7 +97,7 @@ async fn validate_google_token(ctx: &ApiContext, headers: &HeaderMap) -> Result<
(
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "Missing Authorization bearer token",
+ message: "Missing Authorization bearer token".into(),
}),
)
.into_response()
@@ -133,7 +133,7 @@ async fn validate_google_token(ctx: &ApiContext, headers: &HeaderMap) -> Result<
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "Authentication failed and couldn't refresh verification keys",
+ message: "Authentication failed and couldn't refresh verification keys".into(),
}),
).into_response());
}
@@ -151,7 +151,7 @@ async fn validate_google_token(ctx: &ApiContext, headers: &HeaderMap) -> Result<
(
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "Invalid authentication token",
+ message: "Invalid authentication token".into(),
}),
)
.into_response()
@@ -165,7 +165,7 @@ async fn validate_google_token(ctx: &ApiContext, headers: &HeaderMap) -> Result<
Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "Invalid authentication token",
+ message: "Invalid authentication token".into(),
}),
)
.into_response())
diff --git a/rust/cloud-storage/email_service/src/api/internal/delete_user.rs b/rust/cloud-storage/email_service/src/api/internal/delete_user.rs
index af943ba3f3..b453ea5d0e 100644
--- a/rust/cloud-storage/email_service/src/api/internal/delete_user.rs
+++ b/rust/cloud-storage/email_service/src/api/internal/delete_user.rs
@@ -24,7 +24,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to fetch links",
+ message: "unable to fetch links".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/internal/get_message_by_id.rs b/rust/cloud-storage/email_service/src/api/internal/get_message_by_id.rs
index cd703c59e8..72e2480c24 100644
--- a/rust/cloud-storage/email_service/src/api/internal/get_message_by_id.rs
+++ b/rust/cloud-storage/email_service/src/api/internal/get_message_by_id.rs
@@ -25,7 +25,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal server error",
+ message: "internal server error".into(),
}),
)
.into_response()
@@ -37,7 +37,7 @@ pub async fn handler(
Err((
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "message not found",
+ message: "message not found".into(),
}),
)
.into_response())
@@ -57,7 +57,7 @@ pub async fn get_message_by_id_batch_handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal server error",
+ message: "internal server error".into(),
}),
)
.into_response()
@@ -83,7 +83,7 @@ pub async fn get_message_by_id_batch_handler(
Err((
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "messages not found",
+ message: "messages not found".into(),
}),
)
.into_response())
diff --git a/rust/cloud-storage/email_service/src/api/internal/get_messages_by_thread_id.rs b/rust/cloud-storage/email_service/src/api/internal/get_messages_by_thread_id.rs
index 218214a263..3b4286d311 100644
--- a/rust/cloud-storage/email_service/src/api/internal/get_messages_by_thread_id.rs
+++ b/rust/cloud-storage/email_service/src/api/internal/get_messages_by_thread_id.rs
@@ -69,7 +69,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to list messages",
+ message: "unable to list messages".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/internal/get_thread_owner.rs b/rust/cloud-storage/email_service/src/api/internal/get_thread_owner.rs
index b3e6653a69..53fefef43e 100644
--- a/rust/cloud-storage/email_service/src/api/internal/get_thread_owner.rs
+++ b/rust/cloud-storage/email_service/src/api/internal/get_thread_owner.rs
@@ -21,7 +21,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get owner for thread",
+ message: "unable to get owner for thread".into(),
}),
)
.into_response()
@@ -30,7 +30,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "thread not found",
+ message: "thread not found".into(),
}),
)
.into_response()
@@ -40,7 +40,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid macro user id",
+ message: "invalid macro user id".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/internal/gmail/cancel.rs b/rust/cloud-storage/email_service/src/api/internal/gmail/cancel.rs
index b27e613a49..8ea4f83876 100644
--- a/rust/cloud-storage/email_service/src/api/internal/gmail/cancel.rs
+++ b/rust/cloud-storage/email_service/src/api/internal/gmail/cancel.rs
@@ -27,7 +27,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error fetching job",
+ message: "error fetching job".into(),
}),
)
.into_response()
@@ -40,7 +40,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "job does not exist",
+ message: "job does not exist".into(),
}),
)
.into_response()
@@ -50,7 +50,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "job already cancelled",
+ message: "job already cancelled".into(),
}),
)
.into_response());
@@ -58,7 +58,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "job already completed",
+ message: "job already completed".into(),
}),
)
.into_response());
@@ -66,7 +66,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "job already failed",
+ message: "job already failed".into(),
}),
)
.into_response());
@@ -83,7 +83,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error updating job status",
+ message: "error updating job status".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/internal/gmail/create.rs b/rust/cloud-storage/email_service/src/api/internal/gmail/create.rs
index f2a7af0152..1ad5992f98 100644
--- a/rust/cloud-storage/email_service/src/api/internal/gmail/create.rs
+++ b/rust/cloud-storage/email_service/src/api/internal/gmail/create.rs
@@ -44,7 +44,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: format!("error fetching link for id {}", link_id).as_ref(),
+ message: format!("error fetching link for id {}", link_id).into(),
}),
)
.into_response()
@@ -54,7 +54,7 @@ pub async fn handler(
(
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "link id does not exist",
+ message: "link id does not exist".into(),
}),
)
.into_response()
@@ -64,7 +64,7 @@ pub async fn handler(
return Err((
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: format!("sync must be enabled for link {}", link_id).as_ref(),
+ message: format!("sync must be enabled for link {}", link_id).into(),
}),
)
.into_response());
@@ -82,7 +82,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: format!("error creating backfill job for link {}", link_id).as_ref(),
+ message: format!("error creating backfill job for link {}", link_id).into(),
}),
)
.into_response()
@@ -125,7 +125,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: format!("Failed to enqueue backfill message for link {}", link_id).as_ref(),
+ message: format!("Failed to enqueue backfill message for link {}", link_id).into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/api/internal/gmail/get.rs b/rust/cloud-storage/email_service/src/api/internal/gmail/get.rs
index 752748213d..16f8c105cd 100644
--- a/rust/cloud-storage/email_service/src/api/internal/gmail/get.rs
+++ b/rust/cloud-storage/email_service/src/api/internal/gmail/get.rs
@@ -27,7 +27,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "error fetching job",
+ message: "error fetching job".into(),
}),
)
.into_response()
@@ -36,7 +36,7 @@ pub async fn handler(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "job does not exist",
+ message: "job does not exist".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/util/gmail/auth.rs b/rust/cloud-storage/email_service/src/util/gmail/auth.rs
index c9235555c9..3b472aed97 100644
--- a/rust/cloud-storage/email_service/src/util/gmail/auth.rs
+++ b/rust/cloud-storage/email_service/src/util/gmail/auth.rs
@@ -98,7 +98,7 @@ pub async fn fetch_gmail_token_usercontext_response(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get gmail access token",
+ message: "unable to get gmail access token".into(),
}),
)
.into_response()
@@ -128,7 +128,7 @@ pub async fn fetch_gmail_token_no_cache(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get gmail access token",
+ message: "unable to get gmail access token".into(),
}),
)
.into_response()
@@ -141,7 +141,7 @@ pub async fn fetch_gmail_token_no_cache(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get gmail access token",
+ message: "unable to get gmail access token".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/email_service/src/utils.rs b/rust/cloud-storage/email_service/src/utils.rs
index 192e0bea3d..e7c613c384 100644
--- a/rust/cloud-storage/email_service/src/utils.rs
+++ b/rust/cloud-storage/email_service/src/utils.rs
@@ -31,7 +31,7 @@ pub fn extract_email_with_response(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to get email from user id",
+ message: "unable to get email from user id".into(),
}),
)
})
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/mod.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/mod.rs
index 3fd74ba91c..58ca5bca04 100644
--- a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/mod.rs
+++ b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/mod.rs
@@ -92,7 +92,9 @@ impl IntoResponse for ExtractorError {
}
};
- let error_response = ErrorResponse { message: &message };
+ let error_response = ErrorResponse {
+ message: message.into(),
+ };
(status, axum::Json(error_response)).into_response()
}
}
diff --git a/rust/cloud-storage/github/src/inbound.rs b/rust/cloud-storage/github/src/inbound.rs
index a5c7d4020a..4b645483b5 100644
--- a/rust/cloud-storage/github/src/inbound.rs
+++ b/rust/cloud-storage/github/src/inbound.rs
@@ -29,7 +29,9 @@ impl axum::response::IntoResponse for crate::domain::models::GithubError {
(
status_code,
- axum::Json(model_error_response::ErrorResponse { message }),
+ axum::Json(model_error_response::ErrorResponse {
+ message: message.into(),
+ }),
)
.into_response()
}
diff --git a/rust/cloud-storage/macro_middleware/src/auth/attach_user.rs b/rust/cloud-storage/macro_middleware/src/auth/attach_user.rs
index d51f8c9055..f1cc8ae05f 100644
--- a/rust/cloud-storage/macro_middleware/src/auth/attach_user.rs
+++ b/rust/cloud-storage/macro_middleware/src/auth/attach_user.rs
@@ -62,7 +62,7 @@ pub async fn handler(
MacroAuthError::JwtExpired => (
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "jwt expired",
+ message: "jwt expired".into(),
}),
)
.into_response(),
@@ -71,7 +71,7 @@ pub async fn handler(
(
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "unauthorized",
+ message: "unauthorized".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/macro_middleware/src/auth/decode_jwt.rs b/rust/cloud-storage/macro_middleware/src/auth/decode_jwt.rs
index 69d3597d16..7a57a88c50 100644
--- a/rust/cloud-storage/macro_middleware/src/auth/decode_jwt.rs
+++ b/rust/cloud-storage/macro_middleware/src/auth/decode_jwt.rs
@@ -68,7 +68,7 @@ pub async fn handler(
return Err((
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "unauthorized",
+ message: "unauthorized".into(),
}),
)
.into_response());
@@ -81,7 +81,7 @@ pub async fn handler(
MacroAuthError::JwtExpired => (
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "jwt expired",
+ message: "jwt expired".into(),
}),
)
.into_response(),
@@ -90,7 +90,7 @@ pub async fn handler(
(
StatusCode::UNAUTHORIZED,
Json(ErrorResponse {
- message: "unauthorized",
+ message: "unauthorized".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/macro_middleware/src/user_permissions/validate_user_quota.rs b/rust/cloud-storage/macro_middleware/src/user_permissions/validate_user_quota.rs
index 06fd02d624..7b4cdb69df 100644
--- a/rust/cloud-storage/macro_middleware/src/user_permissions/validate_user_quota.rs
+++ b/rust/cloud-storage/macro_middleware/src/user_permissions/validate_user_quota.rs
@@ -37,7 +37,7 @@ pub async fn document_handler(
Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "no permissions were found for user",
+ message: "no permissions were found for user".into(),
}),
)
.into_response())
@@ -70,7 +70,7 @@ pub async fn ai_chat_message_handler(
Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "no permissions were found for user",
+ message: "no permissions were found for user".into(),
}),
)
.into_response())
diff --git a/rust/cloud-storage/model-error-response/src/lib.rs b/rust/cloud-storage/model-error-response/src/lib.rs
index 873ebb149c..dcd1e91e81 100644
--- a/rust/cloud-storage/model-error-response/src/lib.rs
+++ b/rust/cloud-storage/model-error-response/src/lib.rs
@@ -1,10 +1,12 @@
#![deny(missing_docs)]
//! This crate splits out the [ErrorResponse] struct from the mega model crate to reduce coupling
+use std::borrow::Cow;
+
/// A plain old json error response for use with axum.
/// yup, thats it.
#[derive(serde::Serialize, serde::Deserialize, Debug, utoipa::ToSchema)]
pub struct ErrorResponse<'a> {
/// Message to explain failure
- pub message: &'a str,
+ pub message: Cow<'a, str>,
}
diff --git a/rust/cloud-storage/models_pagination/src/axum.rs b/rust/cloud-storage/models_pagination/src/axum.rs
index 0364ea03cd..d0c73c84ca 100644
--- a/rust/cloud-storage/models_pagination/src/axum.rs
+++ b/rust/cloud-storage/models_pagination/src/axum.rs
@@ -58,31 +58,31 @@ impl IntoResponse for CursorExtractErr {
CursorExtractErr::DecodeErr(Base64SerdeErr::DecodeErr(_e)) => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "failed to decode cursor value",
+ message: "failed to decode cursor value".into(),
}),
),
CursorExtractErr::DecodeErr(Base64SerdeErr::SerdeErr(_e)) => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "the cursor contained unexpected data",
+ message: "the cursor contained unexpected data".into(),
}),
),
CursorExtractErr::SizeErr => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "Query is too large, must be <32kb",
+ message: "Query is too large, must be <32kb".into(),
}),
),
CursorExtractErr::InvalidQueryParamsErr => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid cursor query parameters",
+ message: "invalid cursor query parameters".into(),
}),
),
CursorExtractErr::MutuallyExclusiveErr => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "provide only one of cursor or previous_cursor",
+ message: "provide only one of cursor or previous_cursor".into(),
}),
),
}
diff --git a/rust/cloud-storage/notification/src/inbound/http/device.rs b/rust/cloud-storage/notification/src/inbound/http/device.rs
index 65777d4253..ee3372e30e 100644
--- a/rust/cloud-storage/notification/src/inbound/http/device.rs
+++ b/rust/cloud-storage/notification/src/inbound/http/device.rs
@@ -36,7 +36,7 @@ async fn register_device<S: NotificationReader>(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to register device",
+ message: "unable to register device".into(),
}),
)
})?;
@@ -60,7 +60,7 @@ async fn unregister_device<S: NotificationReader>(
(
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "device not found",
+ message: "device not found".into(),
}),
)
})?;
diff --git a/rust/cloud-storage/notification/src/inbound/http/mod.rs b/rust/cloud-storage/notification/src/inbound/http/mod.rs
index ad7fd60ccb..b60d77e9c6 100644
--- a/rust/cloud-storage/notification/src/inbound/http/mod.rs
+++ b/rust/cloud-storage/notification/src/inbound/http/mod.rs
@@ -112,7 +112,7 @@ pub async fn list_user_notifications<
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to get notifications",
+ message: "failed to get notifications".into(),
}),
)
})?;
@@ -172,7 +172,7 @@ pub async fn bulk_get_by_event_item_ids<
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to get notifications",
+ message: "failed to get notifications".into(),
}),
)
})?;
@@ -273,7 +273,7 @@ async fn bulk_update<S: NotificationReader>(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to update notifications",
+ message: "failed to update notifications".into(),
}),
)
})?;
@@ -319,7 +319,7 @@ pub async fn get_by_event_item_id<S: NotificationReader, T: Serialize + Deserial
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to get notifications",
+ message: "failed to get notifications".into(),
}),
)
})?;
@@ -363,7 +363,7 @@ pub async fn get_notification_by_id<
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to get notification",
+ message: "failed to get notification".into(),
}),
)
})?;
@@ -372,7 +372,7 @@ pub async fn get_notification_by_id<
return Err((
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "notification not found",
+ message: "notification not found".into(),
}),
));
};
@@ -409,7 +409,7 @@ pub async fn delete_notification<S: NotificationReader>(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to delete notification",
+ message: "failed to delete notification".into(),
}),
)
})?;
@@ -444,7 +444,7 @@ pub async fn bulk_delete_notifications<S: NotificationReader>(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "failed to delete notifications",
+ message: "failed to delete notifications".into(),
}),
)
})?;
diff --git a/rust/cloud-storage/notification_service/src/api/unsubscribe/get_unsubscribes.rs b/rust/cloud-storage/notification_service/src/api/unsubscribe/get_unsubscribes.rs
index 5b6b2ece20..8bb41566d3 100644
--- a/rust/cloud-storage/notification_service/src/api/unsubscribe/get_unsubscribes.rs
+++ b/rust/cloud-storage/notification_service/src/api/unsubscribe/get_unsubscribes.rs
@@ -36,7 +36,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to unsubscribe item",
+ message: "unable to unsubscribe item".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/notification_service/src/api/unsubscribe/remove_unsubscribe_all.rs b/rust/cloud-storage/notification_service/src/api/unsubscribe/remove_unsubscribe_all.rs
index 042a5546d7..a97ea0e223 100644
--- a/rust/cloud-storage/notification_service/src/api/unsubscribe/remove_unsubscribe_all.rs
+++ b/rust/cloud-storage/notification_service/src/api/unsubscribe/remove_unsubscribe_all.rs
@@ -37,7 +37,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to remove mute all notifications",
+ message: "unable to remove mute all notifications".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/notification_service/src/api/unsubscribe/remove_unsubscribe_item.rs b/rust/cloud-storage/notification_service/src/api/unsubscribe/remove_unsubscribe_item.rs
index c7ff637a57..9d905e609f 100644
--- a/rust/cloud-storage/notification_service/src/api/unsubscribe/remove_unsubscribe_item.rs
+++ b/rust/cloud-storage/notification_service/src/api/unsubscribe/remove_unsubscribe_item.rs
@@ -40,7 +40,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to remove unsubscribe item",
+ message: "unable to remove unsubscribe item".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_all.rs b/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_all.rs
index c58b5b650c..b31f9d9e79 100644
--- a/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_all.rs
+++ b/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_all.rs
@@ -36,7 +36,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to mute all notifications",
+ message: "unable to mute all notifications".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_email.rs b/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_email.rs
index 9a7f55fcf3..d658d4464b 100644
--- a/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_email.rs
+++ b/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_email.rs
@@ -35,7 +35,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to unsubscribe email",
+ message: "unable to unsubscribe email".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_item.rs b/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_item.rs
index b16f96bd4d..8788784795 100644
--- a/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_item.rs
+++ b/rust/cloud-storage/notification_service/src/api/unsubscribe/unsubscribe_item.rs
@@ -48,7 +48,7 @@ pub async fn handler(
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to unsubscribe item",
+ message: "unable to unsubscribe item".into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/notification_service/src/api/user_notification.rs b/rust/cloud-storage/notification_service/src/api/user_notification.rs
index dcc2812d34..f218a45c8c 100644
--- a/rust/cloud-storage/notification_service/src/api/user_notification.rs
+++ b/rust/cloud-storage/notification_service/src/api/user_notification.rs
@@ -372,7 +372,7 @@ async fn get_typed_notification_by_id<S: ::notification::domain::service::Notifi
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(model_error_response::ErrorResponse {
- message: "failed to convert notification",
+ message: "failed to convert notification".into(),
}),
)
})?;
diff --git a/rust/cloud-storage/referral/src/inbound/axum_router.rs b/rust/cloud-storage/referral/src/inbound/axum_router.rs
index 91be5db6f8..4c95601622 100644
--- a/rust/cloud-storage/referral/src/inbound/axum_router.rs
+++ b/rust/cloud-storage/referral/src/inbound/axum_router.rs
@@ -37,7 +37,13 @@ impl IntoResponse for ReferralError {
message = "internal server error".to_string();
}
- (status_code, Json(ErrorResponse { message: &message })).into_response()
+ (
+ status_code,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
}
}
diff --git a/rust/cloud-storage/search_service/src/api/search/simple/mod.rs b/rust/cloud-storage/search_service/src/api/search/simple/mod.rs
index 647111eb0f..5976c0209b 100644
--- a/rust/cloud-storage/search_service/src/api/search/simple/mod.rs
+++ b/rust/cloud-storage/search_service/src/api/search/simple/mod.rs
@@ -73,7 +73,7 @@ impl IntoResponse for SearchError {
(
status_code,
Json(ErrorResponse {
- message: self.to_string().as_str(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/soup/src/inbound/axum_router.rs b/rust/cloud-storage/soup/src/inbound/axum_router.rs
index c3c97c0c6e..d385ae609b 100644
--- a/rust/cloud-storage/soup/src/inbound/axum_router.rs
+++ b/rust/cloud-storage/soup/src/inbound/axum_router.rs
@@ -219,10 +219,14 @@ impl From<SoupErr> for SoupHandlerErr {
impl IntoResponse for SoupHandlerErr {
fn into_response(self) -> axum::response::Response {
+ let status_code = match &self {
+ SoupHandlerErr::ExpandErr(_) => StatusCode::BAD_REQUEST,
+ _ => StatusCode::INTERNAL_SERVER_ERROR,
+ };
(
- StatusCode::INTERNAL_SERVER_ERROR,
+ status_code,
Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/static_file_service/src/api/file/bulk_delete_file.rs b/rust/cloud-storage/static_file_service/src/api/file/bulk_delete_file.rs
index c47d391f3e..a175bde3ef 100644
--- a/rust/cloud-storage/static_file_service/src/api/file/bulk_delete_file.rs
+++ b/rust/cloud-storage/static_file_service/src/api/file/bulk_delete_file.rs
@@ -31,7 +31,7 @@ impl IntoResponse for BulkDeleteError {
(
status_code,
Json(ErrorResponse {
- message: self.as_ref(),
+ message: self.to_string().into(),
}),
)
.into_response()
diff --git a/rust/cloud-storage/teams/src/inbound/axum_router/invite_to_team.rs b/rust/cloud-storage/teams/src/inbound/axum_router/invite_to_team.rs
index 97b6f35bb7..33afe23086 100644
--- a/rust/cloud-storage/teams/src/inbound/axum_router/invite_to_team.rs
+++ b/rust/cloud-storage/teams/src/inbound/axum_router/invite_to_team.rs
@@ -38,26 +38,26 @@ impl axum::response::IntoResponse for InviteToTeamError {
InviteToTeamError::InvalidEmails => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid emails detected",
+ message: "invalid emails detected".into(),
}),
),
InviteToTeamError::NoValidEmailsProvided => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "no emails provided",
+ message: "no emails provided".into(),
}),
),
InviteToTeamError::InviteUsersToTeamError(e) => match e {
InviteUsersToTeamError::TooManyEmails => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "too many emails",
+ message: "too many emails".into(),
}),
),
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to invite users to team",
+ message: "unable to invite users to team".into(),
}),
),
},
diff --git a/rust/cloud-storage/teams/src/inbound/axum_router/middleware.rs b/rust/cloud-storage/teams/src/inbound/axum_router/middleware.rs
index 32dd3cb1d5..6a175e4978 100644
--- a/rust/cloud-storage/teams/src/inbound/axum_router/middleware.rs
+++ b/rust/cloud-storage/teams/src/inbound/axum_router/middleware.rs
@@ -81,7 +81,7 @@ pub enum RoleAccessErr {
impl IntoResponse for RoleAccessErr {
fn into_response(self) -> Response {
let err = Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
});
match self {
RoleAccessErr::MissingTeamId => (StatusCode::BAD_REQUEST, err),
@@ -160,7 +160,7 @@ pub enum PremiumUserErr {
impl IntoResponse for PremiumUserErr {
fn into_response(self) -> Response {
let err = Json(ErrorResponse {
- message: &self.to_string(),
+ message: self.to_string().into(),
});
match self {
PremiumUserErr::UserContextErr | PremiumUserErr::InternalErr(_) => {
diff --git a/rust/cloud-storage/teams/src/inbound/axum_router/mod.rs b/rust/cloud-storage/teams/src/inbound/axum_router/mod.rs
index 85a743da3b..93bd9145f3 100644
--- a/rust/cloud-storage/teams/src/inbound/axum_router/mod.rs
+++ b/rust/cloud-storage/teams/src/inbound/axum_router/mod.rs
@@ -115,19 +115,19 @@ impl IntoResponse for TeamError {
TeamError::TeamDoesNotExist => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "team does not exist",
+ message: "team does not exist".into(),
}),
),
TeamError::TeamInviteDoesNotExist => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "team invite does not exist",
+ message: "team invite does not exist".into(),
}),
),
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal server error",
+ message: "internal server error".into(),
}),
),
}
@@ -141,13 +141,13 @@ impl IntoResponse for CreateTeamError {
CreateTeamError::InvalidTeamName(_) => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "invalid team name",
+ message: "invalid team name".into(),
}),
),
CreateTeamError::StorageLayerError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to create team",
+ message: "unable to create team".into(),
}),
),
}
@@ -161,19 +161,19 @@ impl IntoResponse for DeleteTeamError {
DeleteTeamError::TeamError(_) | DeleteTeamError::StorageLayerError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to delete team",
+ message: "unable to delete team".into(),
}),
),
DeleteTeamError::RemoveRolesFromUserError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "invalid roles provided",
+ message: "invalid roles provided".into(),
}),
),
DeleteTeamError::CustomerError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to delete team subscription",
+ message: "unable to delete team subscription".into(),
}),
),
}
@@ -187,13 +187,13 @@ impl IntoResponse for InviteUsersToTeamError {
InviteUsersToTeamError::TooManyEmails => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "too many emails",
+ message: "too many emails".into(),
}),
),
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to invite users to team",
+ message: "unable to invite users to team".into(),
}),
),
}
@@ -206,7 +206,7 @@ impl IntoResponse for JoinTeamError {
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to join team",
+ message: "unable to join team".into(),
}),
)
.into_response()
@@ -219,19 +219,19 @@ impl IntoResponse for RemoveTeamInviteError {
RemoveTeamInviteError::TeamInviteDoesNotExist => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "team invite does not exist",
+ message: "team invite does not exist".into(),
}),
),
RemoveTeamInviteError::UserNotInTeam => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "user not in team",
+ message: "user not in team".into(),
}),
),
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal server error",
+ message: "internal server error".into(),
}),
),
}
@@ -245,25 +245,25 @@ impl IntoResponse for RemoveUserFromTeamError {
RemoveUserFromTeamError::TeamDoesNotExist => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "team does not exist",
+ message: "team does not exist".into(),
}),
),
RemoveUserFromTeamError::CannotRemoveOwner => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
- message: "cannot remove owner",
+ message: "cannot remove owner".into(),
}),
),
RemoveUserFromTeamError::UserNotInTeam => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "user not in team",
+ message: "user not in team".into(),
}),
),
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "unable to remove user from team",
+ message: "unable to remove user from team".into(),
}),
),
}
@@ -277,19 +277,19 @@ impl IntoResponse for ReinviteError {
ReinviteError::TooManyRequests => (
StatusCode::TOO_MANY_REQUESTS,
Json(ErrorResponse {
- message: "team invite has not been sent in the last 5 minutes",
+ message: "team invite has not been sent in the last 5 minutes".into(),
}),
),
ReinviteError::InviteNotFound => (
StatusCode::NOT_FOUND,
Json(ErrorResponse {
- message: "team invite does not exist",
+ message: "team invite does not exist".into(),
}),
),
ReinviteError::StorageLayerError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(ErrorResponse {
- message: "internal server error",
+ message: "internal server error".into(),
}),
),
}