Skip to content

feat: Add custom exceptions#847

Open
Mr-Sunglasses wants to merge 9 commits intosparckles:mainfrom
Mr-Sunglasses:fix/550
Open

feat: Add custom exceptions#847
Mr-Sunglasses wants to merge 9 commits intosparckles:mainfrom
Mr-Sunglasses:fix/550

Conversation

@Mr-Sunglasses
Copy link
Contributor

Description

This PR fixes #550

@vercel
Copy link

vercel bot commented Jun 10, 2024

@Mr-Sunglasses is attempting to deploy a commit to the sparckles Team on Vercel.

A member of the Team first needs to authorize it.

@Mr-Sunglasses
Copy link
Contributor Author

@sansyrox I've implemented custom HTTPException, take a look and please tell me if it is what we want to achieve in #550 😄

@codspeed-hq
Copy link

codspeed-hq bot commented Jun 10, 2024

CodSpeed Performance Report

Merging #847 will not alter performance

Comparing Mr-Sunglasses:fix/550 (78a8a78) with main (862b764)

Summary

✅ 109 untouched benchmarks

Copy link
Member

@sansyrox sansyrox left a comment

Choose a reason for hiding this comment

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

Hey @Mr-Sunglasses ,

Thanks for the PR. I have some suggestions :D

@Mr-Sunglasses
Copy link
Contributor Author

Hey @Mr-Sunglasses ,

Thanks for the PR. I have some suggestions :D

Thanks, @sansyrox 🙏🏻, for the suggestions, I've fixed then 😄

@sansyrox
Copy link
Member

Hey @Mr-Sunglasses 👋

Could you please add some integration tests? And the CI is also failing for some reason.

class HTTPException(Exception):
def __init__(self, status_code: int, detail: str | None = None) -> None:
if detail is None:
detail = http.HTTPStatus(status_code).phrase
Copy link

Choose a reason for hiding this comment

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

The code attempts to create an HTTPStatus instance with an unchecked status_code, which can raise ValueError for invalid codes (like values above 599 or negative numbers). This exception is not caught, leading to unexpected behavior when an invalid status code is provided. The code should either validate the status_code range first or catch ValueError and provide a fallback message.

📚 Relevant Docs


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

@recurseml
Copy link

recurseml bot commented May 27, 2025

😱 Found 1 issue. Time to roll up your sleeves! 😱

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add custom exceptions in Robyn

2 participants