use std::error::Error;
use axum::http::StatusCode;
pub fn internal_server_error<E: Error>(error: E) -> (StatusCode, String) {
(StatusCode::INTERNAL_SERVER_ERROR, error.to_string())
}
pub trait InternalServiceError<T> {
fn internal_server_error(self) -> Result<T, (StatusCode, String)>;
}
impl<T, E: Error> InternalServiceError<T> for Result<T, E> {
fn internal_server_error(self) -> Result<T, (StatusCode, String)> {
self.map_err(internal_server_error)
}
}