aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/api_server.rs42
-rw-r--r--rust/src/lib.rs2
2 files changed, 32 insertions, 12 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index 4c0f069e..c8b1f012 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -42,7 +42,10 @@ macro_rules! wrap_entity_handlers {
$get_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), id) }),
Err(Error(ErrorKind::Uuid(e), _)) =>
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
- Err(e) => $get_resp::GenericError(ErrorResponse { message: e.to_string() }),
+ Err(e) => {
+ error!("{}", e);
+ $get_resp::GenericError(ErrorResponse { message: e.to_string() })
+ },
};
Box::new(futures::done(Ok(ret)))
}
@@ -59,7 +62,10 @@ macro_rules! wrap_entity_handlers {
$post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::Uuid(e), _)) =>
$post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
- Err(e) => $post_resp::GenericError(ErrorResponse { message: e.to_string() }),
+ Err(e) => {
+ error!("{}", e);
+ $post_resp::GenericError(ErrorResponse { message: e.to_string() })
+ },
};
Box::new(futures::done(Ok(ret)))
}
@@ -76,7 +82,10 @@ macro_rules! wrap_entity_handlers {
$post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::Uuid(e), _)) =>
$post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
- Err(e) => $post_batch_resp::GenericError(ErrorResponse { message: e.to_string() }),
+ Err(e) => {
+ error!("{}", e);
+ $post_batch_resp::GenericError(ErrorResponse { message: e.to_string() })
+ },
};
Box::new(futures::done(Ok(ret)))
}
@@ -110,8 +119,10 @@ 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(e) =>
- $get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(e) => {
+ error!("{}", e);
+ $get_resp::BadRequest(ErrorResponse { message: e.to_string() })
+ },
};
Box::new(futures::done(Ok(ret)))
}
@@ -1153,10 +1164,12 @@ impl Api for Server {
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
GetEditorChangelogResponse::NotFound(
ErrorResponse { message: format!("No such editor: {}", username.clone()) }),
- Err(e) =>
+ Err(e) => {
// TODO: dig in to error type here
+ error!("{}", e);
GetEditorChangelogResponse::GenericError(
- ErrorResponse { message: e.to_string() }),
+ ErrorResponse { message: e.to_string() })
+ },
};
Box::new(futures::done(Ok(ret)))
}
@@ -1172,9 +1185,11 @@ impl Api for Server {
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
GetEditorResponse::NotFound(
ErrorResponse { message: format!("No such editor: {}", username.clone()) }),
- Err(e) =>
+ Err(e) => {
// TODO: dig in to error type here
- GetEditorResponse::GenericError(ErrorResponse { message: e.to_string() }),
+ error!("{}", e);
+ GetEditorResponse::GenericError(ErrorResponse { message: e.to_string() })
+ },
};
Box::new(futures::done(Ok(ret)))
}
@@ -1186,9 +1201,12 @@ impl Api for Server {
) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
let ret = match self.get_stats_handler(more.clone()) {
Ok(stats) => GetStatsResponse::Success(stats),
- Err(e) => GetStatsResponse::GenericError(ErrorResponse {
- message: e.to_string(),
- }),
+ Err(e) => {
+ error!("{}", e);
+ GetStatsResponse::GenericError(ErrorResponse {
+ message: e.to_string(),
+ })
+ },
};
Box::new(futures::done(Ok(ret)))
}
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 8334b3a5..d81035cc 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -14,6 +14,8 @@ extern crate error_chain;
extern crate iron;
#[macro_use]
extern crate serde_json;
+#[macro_use]
+extern crate log;
pub mod api_helpers;
pub mod api_server;