fix(agent): error instance for validation feedback.#520
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces custom error classes to improve error handling in the agent orchestration logic. The changes replace plain error objects with structured error instances that provide better type safety and serialization capabilities.
Changes:
- Added two new error classes:
AgenticaValidationErrorandAgenticaJsonParseErrorwith structured error information and JSON serialization support - Updated
call.tsto use the new error classes instead of plain objects when reporting validation and JSON parsing failures - Exported the new error classes from the main module for package-wide use
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/errors/AgenticaValidationError.ts | New error class for validation failures with structured error details |
| packages/core/src/errors/AgenticaJsonParseError.ts | New error class for JSON parsing failures with reason information |
| packages/core/src/orchestrate/call.ts | Updated to instantiate new error classes instead of plain objects |
| packages/core/src/errors/index.ts | Exports the new error classes |
| packages/core/src/index.ts | Re-exports errors from the main module |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@agentica/benchmark
@agentica/chat
agentica
@agentica/core
create-agentica
@agentica/rpc
@agentica/vector-selector
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces two new custom error classes,
AgenticaValidationErrorandAgenticaJsonParseError, to improve error handling and reporting in the codebase. These error types are now used in the orchestration logic instead of generic error objects, and are exported for use throughout the package. The changes also update the exports to surface the new error classes from the main module.Error Handling Improvements:
AgenticaValidationErrorclass inAgenticaValidationError.tsto standardize validation error reporting, including detailed error information and atoJSONmethod for serialization.AgenticaJsonParseErrorclass inAgenticaJsonParseError.tsto handle JSON parsing errors with structured details and atoJSONmethod.call.tsto use the new error classes (AgenticaValidationErrorandAgenticaJsonParseError) instead of plain objects when reporting validation and JSON parse errors. [1] [2] [3]Exports and Module Organization:
errors/index.tsand updated the main module exports inindex.tsto include the new errors. [1] [2]