fn error_response(&self) -> HttpResponse {
        // Firstly log the error, so we at least know what it was before
        // being serialized.
        error!("Service generated error: {}", self);

        // Since we cannot render the html page here, we serialize
        // it to JSON and let the custom error handling middleware
        // render the HTTP page off of it later.
        let json_str: String =
            serde_json::to_string(self).expect("Could not serialize self to JSON.");

        // Create and return the response with the JSON and the custom
        // content type here.
        HttpResponseBuilder::new(self.status_code())
            .set_header(CONTENT_TYPE, TELESCOPE_ERROR_MIME)
            .body(json_str)
    }
// Override the default http response here.
// Panic if the error cannot be serialized.
Override the default http response here.
Panic if the error cannot be serialized.
Override the default http response here . Panic if the error cannot be serialized .
fn error_response(&self) -> HttpResponse {
        // Firstly log the error, so we at least know what it was before
        // being serialized.
        error!("Service generated error: {}", self);
        // Since we cannot render the html page here, we serialize
        // it to JSON and let the custom error handling middleware
        // render the HTTP page off of it later.
        let json_str: String =
            serde_json::to_string(self).expect("Could not serialize self to JSON.");
        // Create and return the response with the JSON and the custom
        // content type here.
        HttpResponseBuilder::new(self.status_code())
            .set_header(CONTENT_TYPE, TELESCOPE_ERROR_MIME)
            .body(json_str)
    }
fn error_response ( & self ) -> HttpResponse { // Firstly log the error, so we at least know what it was before // being serialized. error ! ( " " self ) ; // Since we cannot render the html page here, we serialize // it to JSON and let the custom error handling middleware // render the HTTP page off of it later. let json_str : String = serde_json :: to_string ( self ) . expect ( " " ) ; // Create and return the response with the JSON and the custom // content type here. HttpResponseBuilder :: new ( self . status_code ( ) ) . set_header ( CONTENT_TYPE , TELESCOPE_ERROR_MIME ) . body ( json_str ) }
Override the default http response here.
Override the default http response here .
&self
&self