Skip to content

Commit fc95f5d

Browse files
author
Kamyar
committed
exception was handled in Parsa SMS
1 parent fbfbdbe commit fc95f5d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Adapters/ParsaSms.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tartan\IranianSms\Adapter;
44

55
use Ghasedak\GhasedakApi;
6+
use Exception;
67

78
class ParsaSms extends AdapterAbstract implements AdapterInterface
89
{
@@ -41,7 +42,13 @@ public function send(String $number, String $message)
4142

4243
$response = curl_exec($curl);
4344
curl_close($curl);
44-
45+
46+
$response_array = json_decode($response,TRUE);
47+
48+
if (!(isset($response_array['result']) && $response_array['result'] == 'success')){
49+
throw new Exception("Error: ".$response);
50+
}
51+
4552
return $response;
4653
}
4754
}

0 commit comments

Comments
 (0)