aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/api_wrappers.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-21 13:07:28 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-21 13:07:28 -0800
commit42265350c9f0b7a5731103c191a807a691f8f2ef (patch)
treedd95a55b7ccba9abfbbda4b7b027aa1b2afaeb59 /rust/src/api_wrappers.rs
parent5e5143caf69c099b0c879ef8546c877280f0e8ee (diff)
downloadfatcat-42265350c9f0b7a5731103c191a807a691f8f2ef.tar.gz
fatcat-42265350c9f0b7a5731103c191a807a691f8f2ef.zip
more state/edit edge case tests
Diffstat (limited to 'rust/src/api_wrappers.rs')
-rw-r--r--rust/src/api_wrappers.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs
index 545a2079..aa7f9ec3 100644
--- a/rust/src/api_wrappers.rs
+++ b/rust/src/api_wrappers.rs
@@ -66,6 +66,8 @@ macro_rules! wrap_entity_handlers {
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::EditgroupAlreadyAccepted(e), _)) =>
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -103,6 +105,8 @@ macro_rules! wrap_entity_handlers {
$post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::EditgroupAlreadyAccepted(e), _)) =>
$post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$post_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -140,6 +144,8 @@ macro_rules! wrap_entity_handlers {
$post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::EditgroupAlreadyAccepted(e), _)) =>
$post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$post_batch_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -183,6 +189,8 @@ macro_rules! wrap_entity_handlers {
$update_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::InvalidEntityStateTransform(e), _)) =>
$update_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $update_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$update_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -224,6 +232,8 @@ macro_rules! wrap_entity_handlers {
$delete_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::InvalidEntityStateTransform(e), _)) =>
$delete_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $delete_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$delete_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -253,6 +263,8 @@ macro_rules! wrap_entity_handlers {
Err(Error(ErrorKind::InvalidFatcatId(e), _)) =>
$get_history_resp::BadRequest(ErrorResponse {
message: ErrorKind::InvalidFatcatId(e).to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $get_history_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_history_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -294,6 +306,8 @@ macro_rules! wrap_entity_handlers {
$get_rev_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
$get_rev_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $get_rev_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_rev_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -316,6 +330,8 @@ macro_rules! wrap_entity_handlers {
$get_edit_resp::FoundEdit(edit),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
$get_edit_resp::NotFound(ErrorResponse { message: format!("No such {} entity edit: {}", stringify!($model), edit_id) }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $get_edit_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_edit_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -341,6 +357,8 @@ macro_rules! wrap_entity_handlers {
$delete_edit_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::EditgroupAlreadyAccepted(e), _)) =>
$delete_edit_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $delete_edit_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$delete_edit_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -370,6 +388,8 @@ macro_rules! wrap_entity_handlers {
Err(Error(ErrorKind::InvalidFatcatId(e), _)) =>
$get_redirects_resp::BadRequest(ErrorResponse {
message: ErrorKind::InvalidFatcatId(e).to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $get_redirects_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_redirects_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -410,6 +430,8 @@ macro_rules! wrap_lookup_handler {
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::MissingOrMultipleExternalId(e), _)) => {
$get_resp::BadRequest(ErrorResponse { message: e.to_string(), }) },
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_resp::BadRequest(ErrorResponse { message: e.to_string() })
@@ -441,6 +463,8 @@ macro_rules! wrap_fcid_handler {
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::NotInControlledVocabulary(e), _)) =>
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_resp::BadRequest(ErrorResponse { message: e.to_string() })
@@ -477,6 +501,8 @@ macro_rules! wrap_fcid_hide_handler {
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::NotInControlledVocabulary(e), _)) =>
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
+ $get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_resp::BadRequest(ErrorResponse { message: e.to_string() })