captcha stats

This commit is contained in:
realaravinth
2021-05-27 14:47:29 +05:30
parent df89938f2a
commit fcdbe66b26
28 changed files with 412 additions and 122 deletions

View File

@@ -194,6 +194,9 @@ pub type ServiceResult<V> = std::result::Result<V, ServiceError>;
pub enum PageError {
#[display(fmt = "Something weng wrong: Internal server error")]
InternalServerError,
#[display(fmt = "{}", _0)]
ServiceError(ServiceError),
}
#[cfg(not(tarpaulin_include))]
@@ -204,6 +207,14 @@ impl From<sqlx::Error> for PageError {
}
}
#[cfg(not(tarpaulin_include))]
impl From<ServiceError> for PageError {
#[cfg(not(tarpaulin_include))]
fn from(e: ServiceError) -> Self {
PageError::ServiceError(e)
}
}
impl ResponseError for PageError {
fn error_response(&self) -> HttpResponse {
use crate::PAGES;
@@ -223,6 +234,7 @@ impl ResponseError for PageError {
fn status_code(&self) -> StatusCode {
match self {
PageError::InternalServerError => StatusCode::INTERNAL_SERVER_ERROR,
PageError::ServiceError(e) => e.status_code(),
}
}
}