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

Using decorators to handle errors #848

Closed
wants to merge 8 commits into from

Conversation

hannaeko
Copy link
Member

@hannaeko hannaeko commented Aug 12, 2021

Purpose

This is very much a work in progress, built on top of #847 to generalize the way error handling is done. This allow to move the error handling out of the request processing to separate the error logic of the request logic. This also ensure that the error management is consistent across all requests.

This PR uses the decorator pattern (sorry if this is not the way to do in Perl, coming from Python that was what makes the more sense to me) and this logic could be extended to other common operation. (I included a commented example of how params validation could be achieved this way but this requires the support of custom error code in the JSON RPC module to be actually implemented.)

If you think this could be an improvement I can finish this work.

Relevant changes: https://github.com/zonemaster/zonemaster-backend/pull/848/files#diff-f159417cb7e91c84742d1cb44858b1eed39152de169ecc78fa6677fe879ac1b2R64-R124

Context

TODO

Changes

TODO

How to test this PR

TODO

@matsduf
Copy link
Contributor

matsduf commented Aug 12, 2021

Could you write a better description? I do not get it.

@hannaeko
Copy link
Member Author

Could you write a better description? I do not get it.

I try to make it clearer

@matsduf
Copy link
Contributor

matsduf commented Sep 15, 2021

@blacksponge, do you plan to work on this?

@matsduf matsduf added this to the v2022.2 milestone May 11, 2022
@matsduf matsduf modified the milestones: v2022.2, v2023.1 Nov 15, 2022
@hannaeko hannaeko closed this May 2, 2023
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