Skip to content

Commit

Permalink
Enhanced error message in create, delete agent (#572)
Browse files Browse the repository at this point in the history
Related to #568

Enhanced HTTPException in `create_agent.py` and `delete_agent.py`.

As this issue states, we aim to improve error messages throughout the
agents-api. I believe this issue can accommodate multiple pull requests.
Your suggestions are highly appreciated.
<!-- ELLIPSIS_HIDDEN -->

----

> [!IMPORTANT]
> Enhanced error messages in `create_agent.py` and `delete_agent.py` for
better clarity in `HTTPException` details.
> 
>   - **Error Messages**:
> - In `create_agent.py`, updated `HTTPException` detail to "Developer
not found. Please ensure the provided auth token (which refers to your
developer_id) is valid and the developer has the necessary permissions
to create an agent."
> - In `delete_agent.py`, updated `HTTPException` detail to "The
specified developer does not own the requested resource. Please verify
the ownership or check if the developer ID is correct."
> 
> <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 a085d41. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->

Co-authored-by: Diwank Singh Tomer <diwank.singh@gmail.com>
  • Loading branch information
JeevaRamanathan and creatorrr authored Oct 4, 2024
1 parent 51f5e65 commit 06813fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion agents-api/agents_api/models/agent/create_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
lambda e: isinstance(e, QueryException)
and "asserted to return some results, but returned none"
in str(e): lambda *_: HTTPException(
detail="developer not found", status_code=403
detail="Developer not found. Please ensure the provided auth token (which refers to your developer_id) is valid and the developer has the necessary permissions to create an agent.",
status_code=403
),
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."),
Expand Down
3 changes: 2 additions & 1 deletion agents-api/agents_api/models/agent/delete_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
lambda e: isinstance(e, QueryException)
and "Developer does not own resource"
in e.resp["display"]: lambda *_: HTTPException(
detail="developer not found or doesnt own resource", status_code=404
detail="The specified developer does not own the requested resource. Please verify the ownership or check if the developer ID is correct.",
status_code=404
),
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."),
Expand Down

0 comments on commit 06813fb

Please sign in to comment.