Skip to content

Commit 593ef07

Browse files
authored
Merge pull request #4 from adityadees/curl-error
fix curl error
2 parents 8e24d0f + 95d1580 commit 593ef07

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Exceptions/ErrorException.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ public static function snimoeValueNotFound(): self
2222
{
2323
return new self("SNlM0e value not found in response. Check __Secure-1PSID value.");
2424
}
25+
26+
public static function curlError($error): self
27+
{
28+
return new self("Curl error: " . $error);
29+
}
2530
}

src/LaravelBard.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LaravelBard
2525
private $reqid;
2626
private $SNlM0e;
2727

28-
public function __construct($timeout = 6, $proxies = null, $session = null)
28+
public function __construct($timeout = 60, $proxies = null, $session = null)
2929
{
3030
$this->proxies = $proxies;
3131
$this->timeout = $timeout;
@@ -120,6 +120,11 @@ public function get_answer($input_text)
120120
]);
121121

122122
$resp = curl_exec($this->session);
123+
124+
if (curl_errno($this->session)) {
125+
throw ErrorException::curlError(curl_error($this->session));
126+
}
127+
123128
$resp_dict = json_decode(explode("\n", $resp)[3], true)[0][2];
124129

125130
if ($resp_dict === null) {

0 commit comments

Comments
 (0)