File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed
Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -74,19 +74,24 @@ public function getIterator(): Generator
7474 */
7575 private function readLine (StreamInterface $ stream ): string
7676 {
77- $ buffer = '' ;
78-
79- while (! $ stream ->eof ()) {
80- if ('' === ($ byte = $ stream ->read (1 ))) {
81- return $ buffer ;
82- }
83- $ buffer .= $ byte ;
84- if ($ byte === "\n" ) {
85- break ;
77+ try {
78+ $ buffer = '' ;
79+
80+ while (! $ stream ->eof ()) {
81+ if ('' === ($ byte = $ stream ->read (1 ))) {
82+ return $ buffer ;
83+ }
84+ $ buffer .= $ byte ;
85+ if ($ byte === "\n" ) {
86+ break ;
87+ }
8688 }
87- }
8889
89- return $ buffer ;
90+ return $ buffer ;
91+ } catch (\Exception $ exception ) {
92+ return $ buffer ;
93+ throw new \Exception ('Error reading line from stream: ' . $ exception ->getMessage () . json_encode ($ stream ));
94+ }
9095 }
9196
9297 public function meta (): MetaInformation
You can’t perform that action at this time.
0 commit comments