Skip to content

Breakout Requests Functionality to New Adapter Module #223

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

Merged
merged 13 commits into from
Jul 19, 2018
Merged
Prev Previous commit
Next Next commit
Expand raise_for_error docstring
  • Loading branch information
Jeffrey Hogan committed Jul 16, 2018
commit 3df84128c8f0c41aca5f6cdc5f03fcb8c79e1189
21 changes: 12 additions & 9 deletions hvac/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@


def raise_for_error(status_code, message=None, errors=None):
"""
"""Helper method to raise exceptions based on the status code of a response received back from Vault.

:param status_code: Status code received in a response from Vault.
:type status_code: int
:param message: Optional message to include in a resulting exception.
:type message: str
:param errors: Optional errors to include in a resulting exception.
:type errors: list | str

:raises: hvac.exceptions.InvalidRequest | hvac.exceptions.Unauthorized | hvac.exceptions.Forbidden |
hvac.exceptions.InvalidPath | hvac.exceptions.RateLimitExceeded | hvac.exceptions.InternalServerError |
hvac.exceptions.VaultNotInitialized | hvac.exceptions.VaultDown | hvac.exceptions.UnexpectedError

:param status_code:
:type status_code:
:param message:
:type message:
:param errors:
:type errors:
:return:
:rtype:
"""
if status_code == 400:
raise exceptions.InvalidRequest(message, errors=errors)
Expand Down