Skip to content

Commit

Permalink
Enhanced the error messages (#575)
Browse files Browse the repository at this point in the history
This PR is to fix the issue mentioned in #572  
I have made the required changes in the files create_agent.py,
create_or_update_agent.py and delete_agent.py. I have added descriptions
to QueryException, ValidationError and TypeError.
<!-- ELLIPSIS_HIDDEN -->

----

> [!IMPORTANT]
> Enhanced error messages for exceptions in agent-related files to
provide detailed guidance on potential issues.
> 
>   - **Error Messages**:
> - Enhanced error messages for `QueryException`, `ValidationError`, and
`TypeError` in `create_agent.py`, `create_or_update_agent.py`, and
`delete_agent.py`.
> - `QueryException`: Now includes a detailed message about potential
causes related to database query failures.
> - `ValidationError`: Provides guidance on checking input data for
missing or incorrect fields.
> - `TypeError`: Describes type mismatch issues and suggests reviewing
input data types.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=julep-ai%2Fjulep&utm_source=github&utm_medium=referral)<sup>
for 049d7ee. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->

Co-authored-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
VivekGuruduttK28 and creatorrr authored Oct 4, 2024
1 parent 4992615 commit 9c38da1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions agents-api/agents_api/models/agent/create_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
in str(e): lambda *_: HTTPException(
detail="developer not found", status_code=403
),
QueryException: partialclass(HTTPException, status_code=400),
ValidationError: partialclass(HTTPException, status_code=400),
TypeError: partialclass(HTTPException, status_code=400),
QueryException: partialclass(HTTPException, status_code=400, detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect."),
ValidationError: partialclass(HTTPException, status_code=400, detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format."),
TypeError: partialclass(HTTPException, status_code=400, detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again."),
}
)
@wrap_in_class(
Expand Down
6 changes: 3 additions & 3 deletions agents-api/agents_api/models/agent/create_or_update_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

@rewrap_exceptions(
{
QueryException: partialclass(HTTPException, status_code=400),
ValidationError: partialclass(HTTPException, status_code=400),
TypeError: partialclass(HTTPException, status_code=400),
QueryException: partialclass(HTTPException, status_code=400,detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect."),
ValidationError: partialclass(HTTPException, status_code=400,detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format."),
TypeError: partialclass(HTTPException, status_code=400,detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again."),
}
)
@wrap_in_class(
Expand Down
6 changes: 3 additions & 3 deletions agents-api/agents_api/models/agent/delete_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
in e.resp["display"]: lambda *_: HTTPException(
detail="developer not found or doesnt own resource", status_code=404
),
QueryException: partialclass(HTTPException, status_code=400),
ValidationError: partialclass(HTTPException, status_code=400),
TypeError: partialclass(HTTPException, status_code=400),
QueryException: partialclass(HTTPException, status_code=400,detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect."),
ValidationError: partialclass(HTTPException, status_code=400,detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format."),
TypeError: partialclass(HTTPException, status_code=400,detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again."),
}
)
@wrap_in_class(
Expand Down

0 comments on commit 9c38da1

Please sign in to comment.