Skip to content

Commit

Permalink
Merge pull request #128 from botris/master
Browse files Browse the repository at this point in the history
Handle bad responses
  • Loading branch information
GhaziTriki authored Apr 7, 2021
2 parents 0d35ceb + ec9172d commit 168e6dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/BigBlueButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
namespace BigBlueButton;

use BigBlueButton\Core\ApiMethod;
use BigBlueButton\Exceptions\BadResponseException;
use BigBlueButton\Parameters\CreateMeetingParameters;
use BigBlueButton\Parameters\DeleteRecordingsParameters;
use BigBlueButton\Parameters\EndMeetingParameters;
Expand Down Expand Up @@ -479,6 +480,10 @@ private function processXmlResponse($url, $payload = '', $contentType = 'applica
if ($data === false) {
throw new \RuntimeException('Unhandled curl error: ' . curl_error($ch));
}
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpcode < 200 || $httpcode >= 300) {
throw new BadResponseException('Bad response, HTTP code: ' . $httpcode);
}
curl_close($ch);

$cookies = file_get_contents($cookiefilepath);
Expand Down
9 changes: 9 additions & 0 deletions src/Exceptions/BadResponseException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace BigBlueButton\Exceptions;

use Exception;

class BadResponseException extends Exception
{
}

0 comments on commit 168e6dc

Please sign in to comment.