Skip to content
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

fix: GRPCException should inherit from APIException #235

Merged
merged 3 commits into from
Nov 30, 2023

Conversation

legau
Copy link
Contributor

@legau legau commented Nov 29, 2023

No description provided.

@legau legau requested a review from AMontagu November 29, 2023 17:41

def log_exception(self, exception: Exception, message: str, extra={}):
logging_level = "ERROR"
if isinstance(exception, GRPCException):
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be issubclass if someone want to override our class to change loggign level no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exceptions are always instanciated

django_socio_grpc/exceptions.py Show resolved Hide resolved
django_socio_grpc/services/servicer_proxy.py Outdated Show resolved Hide resolved
status_code, details = self._get_status_code_and_details(exc)
await context.abort(status_code, details)

def log_exception(self, exception: Exception, message: str, extra={}):
Copy link
Collaborator

Choose a reason for hiding this comment

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

this need doc string and may not have it's place in servicer proxy. Maybe a method in exception.py too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is closely tied with the class and can be easily overriden

@AMontagu AMontagu merged commit 90777ab into master Nov 30, 2023
@AMontagu AMontagu deleted the fix/service-error-handling branch November 30, 2023 15:04
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