Skip to content

Commit 223e158

Browse files
add causedBy to StagehandDefaultError (#1363)
# why - to show the full error stack # what changed - added causedBy to the stagehand default error class # test plan <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds causedBy to StagehandDefaultError to retain the underlying error and make full stacks easier to debug. - **New Features** - StagehandDefaultError now sets causedBy when constructed with Error or StagehandError. - Keeps existing message format; no breaking changes. <sup>Written for commit ce21a92. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
1 parent f26333e commit 223e158

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/swift-hands-divide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
add causedBy to StagehandDefaultError

types/stagehandErrors.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ export class StagehandError extends Error {
99
}
1010

1111
export class StagehandDefaultError extends StagehandError {
12+
public causedBy?: Error | StagehandError;
13+
1214
constructor(error?: unknown) {
1315
if (error instanceof Error || error instanceof StagehandError) {
1416
super(
1517
`\nHey! We're sorry you ran into an error. \nStagehand version: ${STAGEHAND_VERSION} \nIf you need help, please open a Github issue or reach out to us on Slack: https://stagehand.dev/slack\n\nFull error:\n${error.message}`,
1618
);
19+
this.causedBy = error;
1720
}
1821
}
1922
}

0 commit comments

Comments
 (0)