Skip to content

Conversation

@seanmcguire12
Copy link
Member

why

  • easier to debug

what changed

  • added custom error classes for stagehand and stagehand API

@changeset-bot
Copy link

changeset-bot bot commented Mar 20, 2025

🦋 Changeset detected

Latest commit: 58b7e08

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@browserbasehq/stagehand Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

this.name = this.constructor.name;
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make a StagehandDefaultError that extends StagehandError with the message "Hey! We're sorry you ran into an error. If you need help, please open a Github issue or send us a Slack message (link to both)"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ this should go into init, act/extract/observe global

@seanmcguire12 seanmcguire12 requested a review from kamath March 20, 2025 23:39
Copy link
Member

@sameelarif sameelarif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are still a lot of instances of Stagehand throwing a default Error. if you do a global search for throw new Error you'll see a bunch in lib/llm and more elsewhere

@seanmcguire12 seanmcguire12 added act These changes pertain to the act function extract These changes pertain to the extract function observe These changes pertain to the observe function combination These changes affect multiple Stagehand functions text-extract targeted-extract These changes pertain to targeted extract labels Mar 21, 2025
Copy link
Contributor

@kamath kamath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add errors to api and check for those errors and throw the same errors client-side

@seanmcguire12 seanmcguire12 merged commit 1d22604 into main Mar 22, 2025
18 of 30 checks passed
@github-actions github-actions bot mentioned this pull request Mar 22, 2025
kamath pushed a commit that referenced this pull request Mar 25, 2025
* custom error classes

* throw error when act, extract, observe are called instead of immediately

* revert removal (should be done in separate PR)

* rm dumb comments

* changeset

* more errors

* global default error on init, act, extract, observe

* minor

* more errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act These changes pertain to the act function combination These changes affect multiple Stagehand functions extract These changes pertain to the extract function observe These changes pertain to the observe function targeted-extract These changes pertain to targeted extract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants