Skip to content

Using decorators to handle errors#848

Closed
hannaeko wants to merge 8 commits into
zonemaster:developfrom
hannaeko:test-decorators
Closed

Using decorators to handle errors#848
hannaeko wants to merge 8 commits into
zonemaster:developfrom
hannaeko:test-decorators

Conversation

@hannaeko

@hannaeko hannaeko commented Aug 12, 2021

Copy link
Copy Markdown
Contributor

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

matsduf commented Aug 12, 2021

Copy link
Copy Markdown
Contributor

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

@hannaeko

Copy link
Copy Markdown
Contributor Author

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

I try to make it clearer

@matsduf

matsduf commented Sep 15, 2021

Copy link
Copy Markdown
Contributor

@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