/** * @throws AcceptOn\Error if the response failed (non-2xx response). * * @return mixed */ private function throwOrReturnResponseBody($body, $statusCode) { $error = Error::fromResponse($body, $statusCode); if (isset($error)) { throw $error; } return json_decode($body); }
public function testNullForUnknownStatusCode() { $instance = Error::fromResponse("{}", 999); $this->assertNull($instance); }