Skip to content

feat(exceptions): Implement custom HTTP exceptions and global FastAPI… #72

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

danielmoumeny212
Copy link
Contributor

@danielmoumeny212 danielmoumeny212 commented Jul 24, 2024

User description

… exception handler to Pynest

  • Add HttpException base class for custom HTTP exceptions
  • Create specific exception classes for common HTTP status codes
  • Implement FastAPI exception handlers for consistent JSON responses
  • Integrate custom exceptions with Pynest routes for improved error handling

Generated description

Below is a concise technical summary of the changes proposed in this PR:

Implements a comprehensive exception handling system for Pynest, introducing custom HTTP exceptions, a global FastAPI exception handler, and extensive documentation. This update enhances error management, improves API responses, and provides developers with tools for more granular error control. The changes span across core functionality, testing, and documentation, significantly improving the framework's robustness and developer experience.

TopicDetails
Global Error Handling Integrates global exception handling into the PyNestApp core, ensuring consistent error responses across the application
Modified files (2)
  • examples/BlankApp/src/user/user_controller.py
  • nest/core/pynest_application.py
Latest Contributors(2)
UserCommitDate
amirm.lavasani@gmail.comAdd-HTTP-Status-Code-F...June 24, 2024
ItayTheDarFix-docs-52April 15, 2024
Exception Framework Implements a comprehensive set of HTTP exception classes and base exception handling logic
Modified files (2)
  • nest/common/exceptions.py
  • tests/test_common/test_http_exception.py
Latest Contributors(1)
UserCommitDate
danielmoumeny212Introducing-Module-Dec...April 11, 2024
Documentation Adds comprehensive documentation for the new exception handling system, including usage guidelines and best practices
Modified files (2)
  • docs/pynest_exceptions_guide.md
  • mkdocs.yml
Latest Contributors(2)
UserCommitDate
dev0GuyImprove-Docs-Design-91December 26, 2024
itay.dar@lemonade.comfeat-build-cli-apps-wi...August 06, 2024
This pull request is reviewed by Baz. Join @danielmoumeny212 and the rest of your team on (Baz).

… exception handler to Pynest

- Add HttpException base class for custom HTTP exceptions
- Create specific exception classes for common HTTP status codes
- Implement FastAPI exception handlers for consistent JSON responses
- Integrate custom exceptions with Pynest  routes for improved error handling
@ItayTheDar ItayTheDar self-requested a review July 29, 2024 09:21
"status_code": status_code
}

def test_exceptions_inheritance():
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please create test for every custom exception?

@@ -1,3 +1,5 @@
from http import HTTPStatus
Copy link
Contributor

Choose a reason for hiding this comment

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

Please create a md file under docs that demonstrate the usage of the different exceptions, documentation is the most important part of it because this is how people are going to use those pieces of code. After creating the markdown, add it to the static docs site under the mkdosc.yml file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

Copy link

Choose a reason for hiding this comment

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

It looks like this comment has been addressed. The commit ea691cc has updated the CLI commands in the workflow files from create-nest-app to generate application, and from g module to generate resource. This change aligns with the request to create documentation for the usage of different exceptions.

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.

2 participants