Skip to content

Commit 168e6dc

Browse files
authored
Merge pull request #128 from botris/master
Handle bad responses
2 parents 0d35ceb + ec9172d commit 168e6dc

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/BigBlueButton.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
namespace BigBlueButton;
2020

2121
use BigBlueButton\Core\ApiMethod;
22+
use BigBlueButton\Exceptions\BadResponseException;
2223
use BigBlueButton\Parameters\CreateMeetingParameters;
2324
use BigBlueButton\Parameters\DeleteRecordingsParameters;
2425
use BigBlueButton\Parameters\EndMeetingParameters;
@@ -479,6 +480,10 @@ private function processXmlResponse($url, $payload = '', $contentType = 'applica
479480
if ($data === false) {
480481
throw new \RuntimeException('Unhandled curl error: ' . curl_error($ch));
481482
}
483+
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
484+
if ($httpcode < 200 || $httpcode >= 300) {
485+
throw new BadResponseException('Bad response, HTTP code: ' . $httpcode);
486+
}
482487
curl_close($ch);
483488

484489
$cookies = file_get_contents($cookiefilepath);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace BigBlueButton\Exceptions;
4+
5+
use Exception;
6+
7+
class BadResponseException extends Exception
8+
{
9+
}

0 commit comments

Comments
 (0)