Changeset View
Changeset View
Standalone View
Standalone View
src/api/replies.rs
Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | fn into_failure_response(self) -> Failure { | ||||
build_internal_server_error_response(self.description()) | build_internal_server_error_response(self.description()) | ||||
} | } | ||||
} | } | ||||
/* ------------------------------------------------------------- | /* ------------------------------------------------------------- | ||||
Helper methods to prepare API responses | Helper methods to prepare API responses | ||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | ||||
pub fn build_not_found_response() -> Failure { | |||||
Failure::from(Status::NotFound) | |||||
} | |||||
pub fn build_bad_request_response() -> Failure { | |||||
Failure::from(Status::BadRequest) | |||||
} | |||||
pub fn build_internal_server_error_response(message: &str) -> Failure { | pub fn build_internal_server_error_response(message: &str) -> Failure { | ||||
warn!(target:"api", "{}", message); | warn!(target:"api", "{}", message); | ||||
Failure::from(Status::InternalServerError) | Failure::from(Status::InternalServerError) | ||||
} | } | ||||
#[cfg(feature = "pgsql")] | #[cfg(feature = "pgsql")] | ||||
fn build_database_error_response(error_kind: DatabaseErrorKind, info: Box<dyn DatabaseErrorInformation>) -> Failure { | fn build_database_error_response(error_kind: DatabaseErrorKind, info: Box<dyn DatabaseErrorInformation>) -> Failure { | ||||
Show All 16 Lines |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator