So I am trying to implement ResponseError for my custom error object and I would like to make a default error.html page, and in their body or in some <div> I want to insert the error msg which i get from my_error.to_string(). What is the way to achieve this ?
impl ResponseError for NameErr {
fn status_code(&self) -> actix_web::http::StatusCode {
actix_web::http::StatusCode::BAD_REQUEST
}
fn error_response(&self) -> actix_web::HttpResponse {
actix_web::HttpResponse::build(self.status_code())
.insert_header(ContentType::html())
// I WOULD LIKE TO SEND A FILE AS A HTML HERE AND THEN
// RENDER THE ERROR MSG INTO IT
.body(self.to_string())
}
}