How to use the pydeconz.errors.pydeconzException function in pydeconz

To help you get started, we’ve selected a few pydeconz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kane610 / deconz / pydeconz / errors.py View on Github external
https://dresden-elektronik.github.io/deconz-rest-doc/errors/
    """


class RequestError(pydeconzException):
    """Unable to fulfill request.

    Raised when host or API cannot be reached.
    """


class ResponseError(pydeconzException):
    """Invalid response."""


class Unauthorized(pydeconzException):
    """Authorization failed."""


class BadRequest(pydeconzException):
    """The request was not formatted as expected or missing parameters."""


class Forbidden(pydeconzException):
    """The caller has no rights to access the requested URI."""


class ResourceNotFound(pydeconzException):
    """The requested resource (light, group, ...) was not found."""


class BridgeBusy(pydeconzException):
github Kane610 / deconz / pydeconz / errors.py View on Github external
"""Invalid response."""


class Unauthorized(pydeconzException):
    """Authorization failed."""


class BadRequest(pydeconzException):
    """The request was not formatted as expected or missing parameters."""


class Forbidden(pydeconzException):
    """The caller has no rights to access the requested URI."""


class ResourceNotFound(pydeconzException):
    """The requested resource (light, group, ...) was not found."""


class BridgeBusy(pydeconzException):
    """The Bridge is busy, too many requests (more than 20)."""


ERRORS = {
    1: Unauthorized,  # Unauthorized user
    2: BadRequest,  # Body contains invalid JSON
    3: ResourceNotFound,  # Resource not available
    4: RequestError,  # Method not available for resource
    5: BadRequest,  # Missing parameters in body
    6: RequestError,  # Parameter not available
    7: RequestError,  # Invalid value for parameter
    8: RequestError,  # Parameter is not modifiable
github Kane610 / deconz / pydeconz / errors.py View on Github external
def raise_error(error):
    if error:
        cls = ERRORS.get(error["type"], pydeconzException)
        raise cls("{} {}".format(error["address"], error["description"]))
github Kane610 / deconz / pydeconz / errors.py View on Github external
class RequestError(pydeconzException):
    """Unable to fulfill request.

    Raised when host or API cannot be reached.
    """


class ResponseError(pydeconzException):
    """Invalid response."""


class Unauthorized(pydeconzException):
    """Authorization failed."""


class BadRequest(pydeconzException):
    """The request was not formatted as expected or missing parameters."""


class Forbidden(pydeconzException):
    """The caller has no rights to access the requested URI."""


class ResourceNotFound(pydeconzException):
    """The requested resource (light, group, ...) was not found."""


class BridgeBusy(pydeconzException):
    """The Bridge is busy, too many requests (more than 20)."""


ERRORS = {
github Kane610 / deconz / pydeconz / errors.py View on Github external
class pydeconzException(Exception):
    """Base error for pydeconz.

    https://dresden-elektronik.github.io/deconz-rest-doc/errors/
    """


class RequestError(pydeconzException):
    """Unable to fulfill request.

    Raised when host or API cannot be reached.
    """


class ResponseError(pydeconzException):
    """Invalid response."""


class Unauthorized(pydeconzException):
    """Authorization failed."""


class BadRequest(pydeconzException):
    """The request was not formatted as expected or missing parameters."""


class Forbidden(pydeconzException):
    """The caller has no rights to access the requested URI."""


class ResourceNotFound(pydeconzException):
github Kane610 / deconz / pydeconz / errors.py View on Github external
"""deCONZ errors."""


class pydeconzException(Exception):
    """Base error for pydeconz.

    https://dresden-elektronik.github.io/deconz-rest-doc/errors/
    """


class RequestError(pydeconzException):
    """Unable to fulfill request.

    Raised when host or API cannot be reached.
    """


class ResponseError(pydeconzException):
    """Invalid response."""


class Unauthorized(pydeconzException):
    """Authorization failed."""


class BadRequest(pydeconzException):
    """The request was not formatted as expected or missing parameters."""
github Kane610 / deconz / pydeconz / errors.py View on Github external
"""Authorization failed."""


class BadRequest(pydeconzException):
    """The request was not formatted as expected or missing parameters."""


class Forbidden(pydeconzException):
    """The caller has no rights to access the requested URI."""


class ResourceNotFound(pydeconzException):
    """The requested resource (light, group, ...) was not found."""


class BridgeBusy(pydeconzException):
    """The Bridge is busy, too many requests (more than 20)."""


ERRORS = {
    1: Unauthorized,  # Unauthorized user
    2: BadRequest,  # Body contains invalid JSON
    3: ResourceNotFound,  # Resource not available
    4: RequestError,  # Method not available for resource
    5: BadRequest,  # Missing parameters in body
    6: RequestError,  # Parameter not available
    7: RequestError,  # Invalid value for parameter
    8: RequestError,  # Parameter is not modifiable
    901: BridgeBusy,  # May occur when sending too fast
}
github Kane610 / deconz / pydeconz / errors.py View on Github external
"""


class ResponseError(pydeconzException):
    """Invalid response."""


class Unauthorized(pydeconzException):
    """Authorization failed."""


class BadRequest(pydeconzException):
    """The request was not formatted as expected or missing parameters."""


class Forbidden(pydeconzException):
    """The caller has no rights to access the requested URI."""


class ResourceNotFound(pydeconzException):
    """The requested resource (light, group, ...) was not found."""


class BridgeBusy(pydeconzException):
    """The Bridge is busy, too many requests (more than 20)."""


ERRORS = {
    1: Unauthorized,  # Unauthorized user
    2: BadRequest,  # Body contains invalid JSON
    3: ResourceNotFound,  # Resource not available
    4: RequestError,  # Method not available for resource