Skip to content

Commit 5e4fceb

Browse files
committed
Rethrows API exceptions after logging error details
Ensures that exceptions encountered during statement retrieval are not silently handled but instead rethrown after logging error status messages. Improves error transparency and facilitates upstream exception handling.
1 parent c7c2a7c commit 5e4fceb

3 files changed

Lines changed: 10 additions & 12 deletions

File tree

.openapi-generator/templates/Statementor.mustache

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,9 @@ class Statementor extends \Ease\Sand
155155
}
156156
} while ($stop === false);
157157
} catch (\Exception $e) {
158-
$errorMessage = $e->getMessage();
159-
preg_match('/cURL error ([0-9]+)/', $errorMessage, $matches);
160-
161-
if (\array_key_exists(1, $matches)) {
162-
$errorCode = $matches[1];
163-
} elseif (preg_match('/\[([0-9]+)\]/', $errorMessage, $matches)) {
164-
$errorCode = $matches[1];
165-
} else {
166-
$errorCode = 2;
167-
}
158+
$this->addStatusMessage($e->getCode().' Exception when calling GetStatementsRequest: '.$e->getMessage(), 'error', $apiInstance);
168159
169-
$this->addStatusMessage('Exception when calling GetStatementsRequest: '.$errorMessage, 'error', $apiInstance);
160+
throw $e;
170161
}
171162

172163
return $statements;

debian/changelog

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
php-vitexsoftware-rbczpremiumapi (1.5.3) UNRELEASED; urgency=medium
2+
3+
* Statementor rethrow the Api Execeptions
4+
5+
-- vitex <info@vitexsoftware.cz> Fri, 28 Nov 2025 14:28:59 +0100
6+
17
php-vitexsoftware-rbczpremiumapi (1.5.2) unstable; urgency=medium
28

39
* Use certificate serial number instead of SHA1 fingerprint for rate limiting
410
- Renamed getCertificateFingerprint() to getCertificateSerialNumber()
511
- Now uses decimal serial number from certificate for client identification
612
- Updated both ApiClient.php and template to preserve changes
713

8-
-- vitex <info@vitexsoftware.cz> Thu, 21 Nov 2025 19:02:00 +0100
14+
-- vitex <info@vitexsoftware.cz> Fri, 28 Nov 2025 14:28:30 +0100
915

1016
php-vitexsoftware-rbczpremiumapi (1.5.1) unstable; urgency=medium
1117

lib/Statementor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ public function getStatements($currencyCode = 'CZK', string $statementLine = '')
156156
} while ($stop === false);
157157
} catch (\Exception $e) {
158158
$this->addStatusMessage($e->getCode().' Exception when calling GetStatementsRequest: '.$e->getMessage(), 'error', $apiInstance);
159+
159160
throw $e;
160161
}
161162

0 commit comments

Comments
 (0)