Commit 6b5a3c9
authored
Informed error parsing from api (#1327)
## Why:
Errors were being wrapped under an opaque stagehand server error. This
PR helps provide clearer, actionable errors.
## What:
- On system events with status=error, throw new Error with the server
message.
- In the catch block, rethrow non-SyntaxError Errors; only wrap
JSON.parse SyntaxError as StagehandResponseParseError.
## Test Plan:
- [x] Unit test: status=error yields a plain Error with the raw server
message.
- [x] Unit test: invalid JSON is wrapped as StagehandResponseParseError.1 parent 4082b65 commit 6b5a3c9
2 files changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
419 | 421 | | |
420 | 422 | | |
421 | 423 | | |
422 | 424 | | |
423 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
424 | 431 | | |
425 | 432 | | |
426 | 433 | | |
427 | | - | |
428 | | - | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
429 | 437 | | |
430 | 438 | | |
431 | 439 | | |
| |||
0 commit comments