summaryrefslogtreecommitdiffstats
path: root/rust/src/api_wrappers.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-07-25 12:18:34 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-07-25 12:18:34 -0700
commitc4618dd2fb070eefcdb38bca7b92fe32da766702 (patch)
treec874372bb6574e92db1e7bb98029ee0ee186326f /rust/src/api_wrappers.rs
parenta4e45f77b5431e0211337afc67ee586c553590d3 (diff)
downloadfatcat-c4618dd2fb070eefcdb38bca7b92fe32da766702.tar.gz
fatcat-c4618dd2fb070eefcdb38bca7b92fe32da766702.zip
more external ident handling
Diffstat (limited to 'rust/src/api_wrappers.rs')
-rw-r--r--rust/src/api_wrappers.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs
index 8be661e1..e66f3ccd 100644
--- a/rust/src/api_wrappers.rs
+++ b/rust/src/api_wrappers.rs
@@ -35,6 +35,8 @@ macro_rules! wrap_entity_handlers {
Err(Error(ErrorKind::InvalidFatcatId(e), _)) =>
$get_resp::BadRequest(ErrorResponse {
message: ErrorKind::InvalidFatcatId(e).to_string() }),
+ Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
+ $get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -58,6 +60,8 @@ macro_rules! wrap_entity_handlers {
Err(Error(ErrorKind::InvalidFatcatId(e), _)) =>
$post_resp::BadRequest(ErrorResponse {
message: ErrorKind::InvalidFatcatId(e).to_string() }),
+ Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
+ $post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$post_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -81,6 +85,8 @@ macro_rules! wrap_entity_handlers {
Err(Error(ErrorKind::InvalidFatcatId(e), _)) =>
$post_batch_resp::BadRequest(ErrorResponse {
message: ErrorKind::InvalidFatcatId(e).to_string() }),
+ Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
+ $post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$post_batch_resp::GenericError(ErrorResponse { message: e.to_string() })
@@ -127,6 +133,8 @@ macro_rules! wrap_lookup_handler {
$get_resp::FoundEntity(entity),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
$get_resp::NotFound(ErrorResponse { message: format!("Not found: {}", $idname) }),
+ Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
+ $get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(e) => {
error!("{}", e);
$get_resp::BadRequest(ErrorResponse { message: e.to_string() })