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