From e8fc4d55de700aa18099dd7e95f34930c7837f3c Mon Sep 17 00:00:00 2001 From: Henrique Date: Fri, 10 Jul 2026 08:08:01 -0300 Subject: [PATCH 1/2] fix(timeout exception): timeout exception Added validation to catch timeout in communication with sefaz and thrown TimeoutException Refs: IPERP-19446-QBMGSDBHNG-MASTER --- src/Exception/TimeoutException.php | 12 ++++++++++++ src/Soap/SoapCurl.php | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100755 src/Exception/TimeoutException.php diff --git a/src/Exception/TimeoutException.php b/src/Exception/TimeoutException.php new file mode 100755 index 00000000..41ca0c81 --- /dev/null +++ b/src/Exception/TimeoutException.php @@ -0,0 +1,12 @@ +getMessage()); } + if ($this->soaperror_code === CURLE_OPERATION_TIMEDOUT) { + throw TimeoutException::timeoutFault( + "Timeout na comunicação com a SEFAZ [$url]: {$this->soaperror}", + CURLE_OPERATION_TIMEDOUT + ); + } if ($this->soaperror != '') { if ((int)$this->soaperror_code == 0) { $this->soaperror_code = 7; From 68e4a2716ad16668e2d7df3f26260f1b210367fb Mon Sep 17 00:00:00 2001 From: Henrique Date: Thu, 16 Jul 2026 12:13:39 -0300 Subject: [PATCH 2/2] feat(exceptions): throw custom exceptions Throw custom exceptions for empty return from SEFAZ and code other than 200. Refs: IPERP-19446-QBMGSDBHNG-MASTER --- src/Exception/EmptySoapResponseException.php | 12 ++++++++++++ src/Exception/UnexpectedHttpStatusException.php | 12 ++++++++++++ src/Soap/SoapCurl.php | 8 ++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/Exception/EmptySoapResponseException.php create mode 100644 src/Exception/UnexpectedHttpStatusException.php diff --git a/src/Exception/EmptySoapResponseException.php b/src/Exception/EmptySoapResponseException.php new file mode 100644 index 00000000..9b9cd3ff --- /dev/null +++ b/src/Exception/EmptySoapResponseException.php @@ -0,0 +1,12 @@ +responseBody)) { - throw SoapException::soapFault('Retorno da SEFAZ VAZIO', 99); + throw EmptySoapResponseException::soapFault('Retorno da SEFAZ VAZIO', 99); } if (!Validator::isXML($this->responseBody)) { throw SoapException::soapFault('O retorno não é um XML ' . $this->responseBody, 99);