Skip to content

Commit 890862b

Browse files
committed
fix: throw exception instead of exit when caught swagger exception
1 parent b742e57 commit 890862b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Deviddev\BillingoApiV3Wrapper\Exceptions;
4+
5+
use Exception;
6+
7+
class BillingoApiException extends Exception
8+
{
9+
}

src/Services/BillingoApiV3Service.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
namespace Deviddev\BillingoApiV3Wrapper\Services;
44

55
use Exception;
6-
use Deviddev\BillingoApiV3Wrapper\Traits\ProcessErrorsTrait;
76
use Illuminate\Support\Arr;
87
use Swagger\Client\Configuration as SwaggerConfig;
8+
use Deviddev\BillingoApiV3Wrapper\Traits\ProcessErrorsTrait;
9+
use Deviddev\BillingoApiV3Wrapper\Exceptions\BillingoApiException;
910

1011
class BillingoApiV3Service
1112
{
@@ -126,8 +127,9 @@ protected function createResponse(string $methodName, array $params, bool $metho
126127
$params
127128
);
128129
} catch (\Throwable $th) {
129-
echo $this->error($th->getMessage())->response();
130-
exit;
130+
$message = $this->error($th->getMessage())->response();
131+
132+
throw new BillingoApiException($message);
131133
}
132134

133135
$this->setResponse();

0 commit comments

Comments
 (0)