Commit b82b2f63 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'gitlab-server-error'

c21d47ea

 gitlab: report server errors without trying to deserialize
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !132
parents 7bdf95da c21d47ea
......@@ -675,7 +675,13 @@ impl Gitlab {
{
req.header(GitlabPrivateToken(self.token.to_string()));
let rsp = req.send().chain_err(|| ErrorKind::Communication)?;
let success = rsp.status().is_success();
let status = rsp.status();
if status.is_server_error() {
return Err(ErrorKind::Gitlab(
format!("server error: {} {:?}", status.as_u16(),
status.canonical_reason())).into());
}
let success = status.is_success();
let v = serde_json::from_reader(rsp).chain_err(|| ErrorKind::Deserialize)?;
if !success {
return Err(Error::from_gitlab(v));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment