feat: Add CommandFailedException for COPY/MOVE and APPEND, exposing command name, status, server text, and parsed completion code.

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-09-25 12:09:45 -04:00
parent 1ce2013c07
commit 1b68c99521
4 changed files with 157 additions and 8 deletions
@@ -7,6 +7,7 @@ namespace KTXM\ProviderImap\Client\Protocol\Command;
use KTXM\ProviderImap\Client\Protocol\Parser\ResponseCodeParser;
use KTXM\ProviderImap\Client\Protocol\StringEncoder;
use KTXM\ProviderImap\Client\ImapException;
use KTXM\ProviderImap\Client\CommandFailedException;
use KTXM\ProviderImap\Client\Protocol\RequestFrame;
use KTXM\ProviderImap\Client\Protocol\Response\ContinuationResponse;
use KTXM\ProviderImap\Client\Protocol\Response\TaggedResponse;
@@ -81,7 +82,12 @@ final class AppendCommand implements CommandInterface
if ($response instanceof TaggedResponse) {
if (!$response->isOk()) {
throw new ImapException('APPEND failed: ' . $response->text());
throw new CommandFailedException(
'APPEND',
$response->status(),
$response->text(),
$this->responseCodeParser->parse($response->text()),
);
}
return $this->parseAppendUid($response->text());