/** * Create RestApiResponse from curl result. * * Overridden parent functionality so we throw exceptions for errors. * * @returns RestApiResponse */ protected function createResponse($result, $curl_info) { $response = parent::createResponse($result, $curl_info); switch ($response->status) { case 200: case 204: return $response; default: // Useful for debugging // print "\ndebug\n\tRequest: $this->method $this->url\n\tStatus: $response->status: {$response->body->title}\n\t{$response->body->detail}\n\t{$response->body->type}\n"; return $response; } }