Throw package specific exceptions in CallbackStream (#233)

This commit is contained in:
Christopher Hertel 2026-02-08 15:42:10 +01:00 • committed by GitHub
commit 6503059a4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@
namespace Mcp\Server\Transport; namespace Mcp\Server\Transport;
use Mcp\Exception\RuntimeException;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
@ -115,12 +116,12 @@ final class CallbackStream implements \Stringable, StreamInterface
public function seek($offset, $whence = \SEEK_SET): void public function seek($offset, $whence = \SEEK_SET): void
{ {
throw new \RuntimeException('Stream is not seekable'); throw new RuntimeException('Stream is not seekable');
} }
public function rewind(): void public function rewind(): void
{ {
throw new \RuntimeException('Stream is not seekable'); throw new RuntimeException('Stream is not rewindable');
} }
public function isWritable(): bool public function isWritable(): bool
@ -130,7 +131,7 @@ final class CallbackStream implements \Stringable, StreamInterface
public function write($string): int public function write($string): int
{ {
throw new \RuntimeException('Stream is not writable'); throw new RuntimeException('Stream is not writable');
} }
public function isReadable(): bool public function isReadable(): bool