aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/endpoints.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-01-21 16:42:58 -0800
committerBryan Newbold <bnewbold@robocracy.org>2022-01-21 16:52:03 -0800
commitc8b2d48106f92215ca2fbd761f8ac4cf254135e6 (patch)
treee61b3659baa0ad14a87f35e7e6e9769f9d248563 /rust/src/endpoints.rs
parent817b0e76d4b9f5b22e08e90e946af1c14b6cc3e6 (diff)
downloadfatcat-c8b2d48106f92215ca2fbd761f8ac4cf254135e6.tar.gz
fatcat-c8b2d48106f92215ca2fbd761f8ac4cf254135e6.zip
rust: handle database read-only mode (as 5xx errors, not 4xx)
Diffstat (limited to 'rust/src/endpoints.rs')
-rw-r--r--rust/src/endpoints.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/rust/src/endpoints.rs b/rust/src/endpoints.rs
index e04e7315..1a37ecfe 100644
--- a/rust/src/endpoints.rs
+++ b/rust/src/endpoints.rs
@@ -36,7 +36,7 @@ macro_rules! generic_auth_err_responses {
match $val {
NotFound(_, _) | DatabaseRowNotFound => $resp_type::NotFound($val.into()),
InvalidCredentials(_) | InsufficientPrivileges(_) => $resp_type::Forbidden($val.into()),
- DatabaseError(_) | InternalError(_) => {
+ DatabaseError(_) | InternalError(_) | DatabaseReadOnly => {
error!("{}", $val);
capture_fail(&$val);
$resp_type::GenericError($val.into())
@@ -51,7 +51,7 @@ macro_rules! generic_err_responses {
//use crate::errors::FatcatError::*;
match $val {
NotFound(_, _) | DatabaseRowNotFound => $resp_type::NotFound($val.into()),
- DatabaseError(_) | InternalError(_) => {
+ DatabaseError(_) | InternalError(_) | DatabaseReadOnly => {
error!("{}", $val);
capture_fail(&$val);
$resp_type::GenericError($val.into())
@@ -1100,7 +1100,7 @@ impl Api for Server {
NotFound(_, _) | DatabaseRowNotFound => {
CreateEditgroupResponse::NotFound(fe.into())
}
- DatabaseError(_) | InternalError(_) => {
+ DatabaseError(_) | InternalError(_) | DatabaseReadOnly => {
error!("{}", fe);
capture_fail(&fe);
CreateEditgroupResponse::GenericError(fe.into())
@@ -1209,7 +1209,7 @@ impl Api for Server {
{
Ok(changelog) => GetChangelogResponse::Success(changelog),
Err(fe) => match fe {
- DatabaseError(_) | InternalError(_) => {
+ DatabaseError(_) | InternalError(_) | DatabaseReadOnly => {
error!("{}", fe);
capture_fail(&fe);
GetChangelogResponse::GenericError(fe.into())
@@ -1274,7 +1274,7 @@ impl Api for Server {
InvalidCredentials(_) | InsufficientPrivileges(_) => {
AuthOidcResponse::Forbidden(fe.into())
}
- DatabaseError(_) | InternalError(_) => {
+ DatabaseError(_) | InternalError(_) | DatabaseReadOnly => {
error!("{}", fe);
capture_fail(&fe);
AuthOidcResponse::GenericError(fe.into())
@@ -1322,7 +1322,7 @@ impl Api for Server {
InvalidCredentials(_) | InsufficientPrivileges(_) => {
AuthCheckResponse::Forbidden(fe.into())
}
- DatabaseError(_) | InternalError(_) => {
+ DatabaseError(_) | InternalError(_) | DatabaseReadOnly => {
error!("{}", fe);
capture_fail(&fe);
AuthCheckResponse::GenericError(fe.into())
@@ -1373,7 +1373,7 @@ impl Api for Server {
InvalidCredentials(_) | InsufficientPrivileges(_) => {
CreateAuthTokenResponse::Forbidden(fe.into())
}
- DatabaseError(_) | InternalError(_) => {
+ DatabaseError(_) | InternalError(_) | DatabaseReadOnly => {
error!("{}", fe);
capture_fail(&fe);
CreateAuthTokenResponse::GenericError(fe.into())