mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
captcha stats
This commit is contained in:
@@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user