diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-06-21 11:51:40 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-06-21 11:51:40 -0700 |
commit | 256b297886352fd0e732183e00d476bb32bc663e (patch) | |
tree | 29b36eacee790e6d2356c61ed25ed6f7250f578e /rust/src | |
parent | cb63f207258071ade7f300dc63e9ed8cb98a1353 (diff) | |
download | fatcat-256b297886352fd0e732183e00d476bb32bc663e.tar.gz fatcat-256b297886352fd0e732183e00d476bb32bc663e.zip |
no more default/mangled HTTP status codes
Diffstat (limited to 'rust/src')
-rw-r--r-- | rust/src/api_server.rs | 37 | ||||
-rw-r--r-- | rust/src/bin/fatcatd.rs | 5 |
2 files changed, 25 insertions, 17 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index c8b1f012..61005226 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -1159,17 +1159,19 @@ impl Api for Server { _context: &Context, ) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> { let ret = match self.editor_changelog_get_handler(username.clone()) { - Ok(entries) => - GetEditorChangelogResponse::FoundMergedChanges(entries), - Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => - GetEditorChangelogResponse::NotFound( - ErrorResponse { message: format!("No such editor: {}", username.clone()) }), + Ok(entries) => GetEditorChangelogResponse::FoundMergedChanges(entries), + Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => { + GetEditorChangelogResponse::NotFound(ErrorResponse { + message: format!("No such editor: {}", username.clone()), + }) + } Err(e) => { // TODO: dig in to error type here error!("{}", e); - GetEditorChangelogResponse::GenericError( - ErrorResponse { message: e.to_string() }) - }, + GetEditorChangelogResponse::GenericError(ErrorResponse { + message: e.to_string(), + }) + } }; Box::new(futures::done(Ok(ret))) } @@ -1180,16 +1182,19 @@ impl Api for Server { _context: &Context, ) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> { let ret = match self.get_editor_handler(username.clone()) { - Ok(entity) => - GetEditorResponse::FoundEditor(entity), - Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => - GetEditorResponse::NotFound( - ErrorResponse { message: format!("No such editor: {}", username.clone()) }), + Ok(entity) => GetEditorResponse::FoundEditor(entity), + Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => { + GetEditorResponse::NotFound(ErrorResponse { + message: format!("No such editor: {}", username.clone()), + }) + } Err(e) => { // TODO: dig in to error type here error!("{}", e); - GetEditorResponse::GenericError(ErrorResponse { message: e.to_string() }) - }, + GetEditorResponse::GenericError(ErrorResponse { + message: e.to_string(), + }) + } }; Box::new(futures::done(Ok(ret))) } @@ -1206,7 +1211,7 @@ impl Api for Server { GetStatsResponse::GenericError(ErrorResponse { message: e.to_string(), }) - }, + } }; Box::new(futures::done(Ok(ret))) } diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs index 4778df9e..1e0c3e53 100644 --- a/rust/src/bin/fatcatd.rs +++ b/rust/src/bin/fatcatd.rs @@ -71,7 +71,10 @@ fn main() { } let host_port = "localhost:9411"; - info!(logger, "Starting fatcatd API server on http://{}", &host_port); + info!( + logger, + "Starting fatcatd API server on http://{}", &host_port + ); let mut chain = Chain::new(LoggerMiddleware::new(router, logger, formatter)); |