This commit is contained in:
ntr 2019-06-25 19:50:15 +10:00
parent 73e168ef23
commit 4c3c81ade1

View File

@ -39,10 +39,10 @@ impl ResponseError for MnmlHttpError {
fn error_response(&self) -> HttpResponse {
match *self {
MnmlHttpError::ServerError => HttpResponse::InternalServerError()
.json(RpcErrorResponse { err: "server error".to_string() }),
.json(RpcErrorResponse { err: self.to_string() }),
MnmlHttpError::BadRequest => HttpResponse::BadRequest()
.json(RpcErrorResponse { err: "bad request ".to_string() }),
.json(RpcErrorResponse { err: self.to_string() }),
MnmlHttpError::Unauthorized => HttpResponse::Unauthorized()
.cookie(Cookie::build("x-auth-token", "")
@ -51,7 +51,7 @@ impl ResponseError for MnmlHttpError {
.same_site(SameSite::Strict)
.max_age(-1) // 1 week aligns with db set
.finish())
.json(RpcErrorResponse { err: "unauthorized ".to_string() }),
.json(RpcErrorResponse { err: self.to_string() }),
}
}
}