-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[STG-710] Utilize custom error types #1254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: fcb82c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
Greptile OverviewGreptile SummaryThis PR successfully ports custom error types from V2 to V3, replacing 30+ generic Key Changes
Impact
The implementation is clean, consistent with existing error types, and maintains backward compatibility by extending the Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant V3
participant Handler
participant Understudy
participant CustomError
User->>V3: Call act/extract/observe/agent
alt Missing Configuration
V3->>CustomError: throw MissingLLMConfigurationError
CustomError-->>User: Clear error with actionable message
else Invalid Argument
V3->>CustomError: throw StagehandInvalidArgumentError
CustomError-->>User: Error details with validation info
else Not Initialized
V3->>CustomError: throw StagehandNotInitializedError
CustomError-->>User: Instruction to call init()
else Experimental Feature Conflict
V3->>CustomError: throw ExperimentalNotConfiguredError
CustomError-->>User: Configuration guidance
end
User->>Handler: Execute operation
alt Element Not Found
Handler->>Understudy: Resolve element
Understudy->>CustomError: throw StagehandElementNotFoundError
CustomError-->>User: XPath/selector details
else Evaluation Failed
Handler->>Understudy: Evaluate script
Understudy->>CustomError: throw StagehandEvalError
CustomError-->>User: Evaluation error details
else Invalid Input
Understudy->>CustomError: throw StagehandInvalidArgumentError
CustomError-->>User: Input validation error
end
Note over User,CustomError: All errors extend StagehandError base class
Note over User,CustomError: Provides consistent error handling and debugging
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11 files reviewed, no comments
why
Custom error types allow for a better debugging experience. We used these error instances in V2 - just porting them over to our current codebase.
what changed
Implemented previously used error instance types into V3.
test plan