Skip to content

Commit 03eabb3

Browse files
author
Bernhard Kaszt
committed
ErrorListener: Fixed wrong parameter being passed to the RuntimeException
1 parent be597ac commit 03eabb3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/Gitlab/HttpClient/Listener/ErrorListener.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@ public function postSend(RequestInterface $request, MessageInterface $response)
4848
}
4949
}
5050

51-
throw new RuntimeException(isset($content['message']) ? $content['message'] : $content, $response->getStatusCode());
51+
$errorMessage = null;
52+
if (isset($content['error'])) {
53+
$errorMessage = implode("\n", $content['error']);
54+
} else if (isset($content['message'])) {
55+
$errorMessage = $content['message'];
56+
} else {
57+
$errorMessage = $content;
58+
}
59+
60+
throw new RuntimeException($errorMessage, $response->getStatusCode());
5261
}
5362
}
5463
}

0 commit comments

Comments
 (0)