From cede6e1eeafc9ab765cf819c38dcfac5a748b695 Mon Sep 17 00:00:00 2001 From: Doug Kulak Date: Mon, 7 Aug 2023 15:32:29 -0700 Subject: [PATCH] Make sendRequest throw Exception containing curl_error if response is false --- src/OpenAi.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OpenAi.php b/src/OpenAi.php index ffc7a99..ed38d98 100644 --- a/src/OpenAi.php +++ b/src/OpenAi.php @@ -548,6 +548,8 @@ private function sendRequest(string $url, string $method, array $opts = []) curl_close($curl); + if (!$response) throw new Exception(curl_error($curl)); + return $response; }