Skip to content

Use ImapConnectionException as abstract base class for all ImapConnectionExceptions #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Connection/ImapConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use DirectoryTree\ImapEngine\Exceptions\Exception;
use DirectoryTree\ImapEngine\Exceptions\ImapCommandException;
use DirectoryTree\ImapEngine\Exceptions\ImapConnectionClosedException;
use DirectoryTree\ImapEngine\Exceptions\ImapConnectionException;
use DirectoryTree\ImapEngine\Exceptions\ImapConnectionFailedException;
use DirectoryTree\ImapEngine\Exceptions\ImapConnectionTimedOutException;
use DirectoryTree\ImapEngine\Exceptions\ImapResponseException;
Expand Down Expand Up @@ -749,7 +748,7 @@ protected function nextReply(): Data|Token|Response|null
throw match (true) {
$meta['timed_out'] ?? false => new ImapConnectionTimedOutException('Stream timed out, no response'),
$meta['eof'] ?? false => new ImapConnectionClosedException('Server closed the connection (EOF)'),
default => new ImapConnectionException('Unknown stream error. Metadata: '.json_encode($meta)),
default => new ImapConnectionFailedException('Unknown stream error. Metadata: '.json_encode($meta)),
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/ImapConnectionClosedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

namespace DirectoryTree\ImapEngine\Exceptions;

class ImapConnectionClosedException extends Exception {}
class ImapConnectionClosedException extends ImapConnectionException {}
2 changes: 1 addition & 1 deletion src/Exceptions/ImapConnectionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

namespace DirectoryTree\ImapEngine\Exceptions;

class ImapConnectionException extends Exception {}
abstract class ImapConnectionException extends Exception {}
2 changes: 1 addition & 1 deletion src/Exceptions/ImapConnectionFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

namespace DirectoryTree\ImapEngine\Exceptions;

class ImapConnectionFailedException extends Exception {}
class ImapConnectionFailedException extends ImapConnectionException {}
2 changes: 1 addition & 1 deletion src/Exceptions/ImapConnectionTimedOutException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

namespace DirectoryTree\ImapEngine\Exceptions;

class ImapConnectionTimedOutException extends Exception {}
class ImapConnectionTimedOutException extends ImapConnectionException {}