From 50b4ea1e090f3718ff615d0ec5a1a0296f36c3b2 Mon Sep 17 00:00:00 2001 From: webklex Date: Fri, 23 Jun 2023 21:34:54 +0200 Subject: [PATCH] Protocol exception handling improved (bad response message added) #408 --- CHANGELOG.md | 1 + src/Connection/Protocols/ImapProtocol.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1a0f0b..e50b541 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip ### Fixed - Legacy protocol support fixed (object to array conversion) #411 - Header value decoding improved #410 +- Protocol exception handling improved (bad response message added) #408 ### Added - NaN diff --git a/src/Connection/Protocols/ImapProtocol.php b/src/Connection/Protocols/ImapProtocol.php index 914347b..b5d84b5 100644 --- a/src/Connection/Protocols/ImapProtocol.php +++ b/src/Connection/Protocols/ImapProtocol.php @@ -303,10 +303,10 @@ public function readResponse(Response $response, string $tag, bool $dontParse = if ($tokens[0] == 'OK') { return $lines ?: [true]; } elseif ($tokens[0] == 'NO' || $tokens[0] == 'BAD' || $tokens[0] == 'BYE') { - throw new ImapServerErrorException(); + throw new ImapServerErrorException(implode("\n", $tokens)); } - throw new ImapBadRequestException(); + throw new ImapBadRequestException(implode("\n", $tokens)); } /**