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

Cleaning exceptions #58

Open
lnlrbr opened this issue Nov 16, 2017 · 0 comments
Open

Cleaning exceptions #58

lnlrbr opened this issue Nov 16, 2017 · 0 comments

Comments

@lnlrbr
Copy link
Contributor

lnlrbr commented Nov 16, 2017

BackendException is used in several modules but it's raised for two different purpose in the backend connection process in client.py:

  • with code >1000 for errors in the first stage connection = Requests errors are reencoded
  • with specific HTTP errors codes when the connection to the backend is established, but the backend returns some specific errors (login error, bad url requested, hosts not found, ...).
    The first stage errors (code>1000) are only used in the tests, while the others are only catches by module_backend for 404/422 http errors.
    On the other hand, the response BackendException's parameter is never really used by the others modules except for logging, it's just used in webui and module_logs in returned results. Problem: this parameter is only filled by second stage errors, after a successful connection, else =None.
    Proposed solutions:
  • Keep BackendException for first stage errors, and create a second Exception class for specific Backend errors in second stage responses. Pros: Clear separation in stages. Cons: several modules need to be rewritten.
  • Keep only one specific error for all first stage errors (1000 for example) and set the "message" BackendException's parameter to the returned Requests error message with a false generated response parameter, and continue to use the second stage errors as is. Pros: no need to rewrite modules, just tests. Cons: no separation in connection stages (but who care about it?)
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

No branches or pull requests

1 participant