let err : GameError = err;
if let GameError::InternalErrorSVG(svg) = err { throw!(svg) }
eprintln!("API {:?} => {:?}", &form, &err);
+ // Restating the state of this piece (with a new generation)
+ // will forcibly synchronise the client which made the failing
+ // request.
+ let mut buf = PrepareUpdatesBuffer::new(g, None, None);
+ buf.piece_update(piece, PieceUpdateOp::Modify(()), &lens);
+ throw!(err);
},
Ok((update, logents)) => {
let mut buf = PrepareUpdatesBuffer::new(g, Some((client, form.cseq)),
NoClient,
#[error("player not part of game (removed?)")]
NoPlayer,
+ #[error("game operation error")]
+ GameError(#[from] GameError),
#[error("invalid Z coordinate")]
InvalidZCoord,
#[error("JSON~ serialisation error: {0:?}")]
| ServerFailure(_)
=> Status::InternalServerError,
NoClient | NoPlayer | GameBeingDestroyed => Status::NotFound,
- InvalidZCoord => Status::BadRequest,
+ InvalidZCoord | OnlineError::GameError(_) => Status::BadRequest,
};
let mut resp = Responder::respond_to(msg,req).unwrap();
resp.set_status(status);