Add documentation for YggdrasilError.

This commit is contained in:
joo committed 2017-03-31 14:33:51 +01:00
1 parent bc260b0a91
commit e99d2a4ef5
1 file changed
+28 -5
+28 -5
View File
@@ -6,7 +6,14 @@ Contains the `Exceptions` used by this library.
class YggdrasilError(Exception): class YggdrasilError(Exception):
""" """
Base `Exception` for the Yggdrasil authentication service. Base `Exception` for the Yggdrasil authentication service.
:param str message: A human-readable string representation of the error.
:param int status_code: Initial value of :attr:`status_code`.
:param str yggdrasil_error: Initial value of :attr:`yggdrasil_error`.
:param str yggdrasil_message: Initial value of :attr:`yggdrasil_message`.
:param str yggdrasil_cause: Initial value of :attr:`yggdrasil_cause`.
""" """
def __init__( def __init__(
self, self,
message=None, message=None,
@@ -14,17 +21,33 @@ class YggdrasilError(Exception):
yggdrasil_error=None, yggdrasil_error=None,
yggdrasil_message=None, yggdrasil_message=None,
yggdrasil_cause=None, yggdrasil_cause=None,
*args
): ):
if message is not None: super(YggdrasilError, self).__init__(message)
args = (message,) + args
super(YggdrasilError, self).__init__(*args)
self.status_code = status_code self.status_code = status_code
self.yggdrasil_error = yggdrasil_error self.yggdrasil_error = yggdrasil_error
self.yggdrasil_message = yggdrasil_message self.yggdrasil_message = yggdrasil_message
self.yggdrasil_cause = yggdrasil_cause self.yggdrasil_cause = yggdrasil_cause
status_code = None
"""`int` or `None`. The associated HTTP status code. May be set."""
yggdrasil_error = None
"""`str` or `None`. The `"error"` field of the Yggdrasil response: a short
description such as `"Method Not Allowed"` or
`"ForbiddenOperationException"`. May be set.
"""
yggdrasil_message = None
"""`str` or `None`. The `"errorMessage"` field of the Yggdrasil response:
a longer description such as `"Invalid credentials. Invalid username or
password."`. May be set.
"""
yggdrasil_cause = None
"""`str` or `None`. The `"cause"` field of the Yggdrasil response: a string
containing additional information about the error. May be set.
"""
class VersionMismatch(Exception): class VersionMismatch(Exception):
pass pass