Module hug.exceptions

hug/exceptions.py

Defines the custom exceptions that are part of, and support

Copyright (C) 2016 Timothy Edmund Crosley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View Source
"""hug/exceptions.py

Defines the custom exceptions that are part of, and support

Copyright (C) 2016  Timothy Edmund Crosley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated

documentation files (the "Software"), to deal in the Software without restriction, including without limitation

the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and

to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or

substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED

TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF

CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

OTHER DEALINGS IN THE SOFTWARE.

"""

from __future__ import absolute_import

class InvalidTypeData(Exception):

    """Should be raised when data passed in doesn't match a types expectations"""

    def __init__(self, message, reasons=None):

        self.message = message

        self.reasons = reasons

class StoreKeyNotFound(Exception):

    """Should be raised when a store key has not been found inside a store"""

class SessionNotFound(StoreKeyNotFound):

    """Should be raised when a session ID has not been found inside a session store"""

    pass

Classes

InvalidTypeData

class InvalidTypeData(
    message,
    reasons=None
)

Should be raised when data passed in doesn't match a types expectations

View Source
class InvalidTypeData(Exception):

    """Should be raised when data passed in doesn't match a types expectations"""

    def __init__(self, message, reasons=None):

        self.message = message

        self.reasons = reasons

Ancestors (in MRO)

  • builtins.Exception
  • builtins.BaseException

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

Exception.with_traceback(tb) -- set self.traceback to tb and return self.

SessionNotFound

class SessionNotFound(
    /,
    *args,
    **kwargs
)

Should be raised when a session ID has not been found inside a session store

View Source
class SessionNotFound(StoreKeyNotFound):

    """Should be raised when a session ID has not been found inside a session store"""

    pass

Ancestors (in MRO)

  • hug.exceptions.StoreKeyNotFound
  • builtins.Exception
  • builtins.BaseException

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

Exception.with_traceback(tb) -- set self.traceback to tb and return self.

StoreKeyNotFound

class StoreKeyNotFound(
    /,
    *args,
    **kwargs
)

Should be raised when a store key has not been found inside a store

View Source
class StoreKeyNotFound(Exception):

    """Should be raised when a store key has not been found inside a store"""

Ancestors (in MRO)

  • builtins.Exception
  • builtins.BaseException

Descendants

  • hug.exceptions.SessionNotFound

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

Exception.with_traceback(tb) -- set self.traceback to tb and return self.