feat(06-sonarqube-quality): introduce typed exception hierarchy (S112 fix)

Replace 86+ generic RuntimeException throws with domain-specific exception
classes: AllegroApiException, AllegroOAuthException, ApaczkaApiException,
ShipmentException, IntegrationConfigException — all extending OrderProException
extends RuntimeException. Existing catch(RuntimeException) blocks unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 11:04:52 +01:00
parent 3a9cfcd4a2
commit 3c27c4e54a
21 changed files with 141 additions and 87 deletions

View File

@@ -7,6 +7,7 @@ use App\Core\Support\StringHelper;
use App\Modules\Orders\OrderImportRepository;
use App\Modules\Orders\OrdersRepository;
use RuntimeException;
use AppCoreExceptionsAllegroApiException;
use Throwable;
final class AllegroOrderImportService
@@ -28,7 +29,7 @@ final class AllegroOrderImportService
{
$orderId = trim($checkoutFormId);
if ($orderId === '') {
throw new RuntimeException('Podaj ID zamowienia Allegro.');
throw new AllegroApiException('Podaj ID zamowienia Allegro.');
}
[$accessToken, $env] = $this->tokenManager->resolveToken();
@@ -101,7 +102,7 @@ final class AllegroOrderImportService
{
$checkoutFormId = trim((string) ($payload['id'] ?? ''));
if ($checkoutFormId === '') {
throw new RuntimeException('Odpowiedz Allegro nie zawiera ID zamowienia.');
throw new AllegroApiException('Odpowiedz Allegro nie zawiera ID zamowienia.');
}
$status = trim((string) ($payload['status'] ?? ''));