File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<?php
22
3-
43namespace ClaudeAgentSDK \Exceptions ;
54
5+ use Throwable ;
6+
67class JsonParseException extends ClaudeAgentException
78{
8- public function __construct (
9- public readonly string $ line ,
10- public readonly ?\Throwable $ originalError = null ,
11- ) {
12- parent ::__construct ("Failed to parse JSON line: {$ line }" , previous: $ originalError );
9+ public readonly string $ rawLine ;
10+ public readonly ?Throwable $ originalError ;
11+
12+ public function __construct (string $ rawLine , ?Throwable $ originalError = null )
13+ {
14+ $ this ->rawLine = $ rawLine ;
15+ $ this ->originalError = $ originalError ;
16+
17+ parent ::__construct (
18+ "Failed to parse JSON line: {$ rawLine }" ,
19+ 0 ,
20+ $ originalError ,
21+ );
1322 }
1423}
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public function test_json_parse_exception(): void
3939 $ prev = new RuntimeException ('bad json ' );
4040 $ e = new JsonParseException ('{invalid ' , $ prev );
4141
42- $ this ->assertSame ('{invalid ' , $ e ->line );
42+ $ this ->assertSame ('{invalid ' , $ e ->rawLine );
4343 $ this ->assertSame ($ prev , $ e ->originalError );
4444 $ this ->assertStringContainsString ('{invalid ' , $ e ->getMessage ());
4545 }
You can’t perform that action at this time.
0 commit comments