diff --git a/lib/CannotWriteChunkException.php b/lib/CannotWriteChunkException.php new file mode 100644 index 0000000..890e48d --- /dev/null +++ b/lib/CannotWriteChunkException.php @@ -0,0 +1,23 @@ +chunk = $chunk; + } + + public function getChunk(): string + { + return $this->chunk; + } +} diff --git a/lib/ResourceOutputStream.php b/lib/ResourceOutputStream.php index f34184b..7da135b 100644 --- a/lib/ResourceOutputStream.php +++ b/lib/ResourceOutputStream.php @@ -92,7 +92,7 @@ final class ResourceOutputStream implements OutputStream if ($error = \error_get_last()) { $message .= \sprintf("; %s", $error["message"]); } - throw new StreamException($message); + throw new CannotWriteChunkException($data, $message); } $writes->unshift([$data, $previous, $deferred]);