reponse error payload

This commit is contained in:
mpostma 2020-05-26 13:41:12 +02:00
parent e2546f2646
commit 4254cfbce5

View File

@ -204,11 +204,12 @@ impl fmt::Display for Error {
impl aweb::error::ResponseError for ResponseError {
fn error_response(&self) -> aweb::HttpResponse {
let error_code = self.inner.error_code().internal();
let error_code = self.inner.error_code();
ResponseBuilder::new(self.status_code()).json(json!({
"message": self.to_string(),
"errorCode": error_code,
"errorLink": format!("docs.meilisearch.come/error/{}", error_code),
"errorCode": error_code.name(),
"errorType": error_code.r#type(),
"errorLink": error_code.url(),
}))
}