/usr/share/pyshared/sunlight/errors.py is in python-sunlight 1.1.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # Copyright (c) Sunlight Labs, 2012 under the terms and conditions
# of the LICENSE file.
"""
.. module:: sunlight.errors
:synopsis: Exceptions and Errors
"""
class SunlightException(Exception):
"""
:class:`sunlight.errors.SunlightException` is the base exception,
all other sunlight exceptions (such as
:class:`sunlight.errors.NoAPIKeyException`) all inherit from this. This
makes it easy to catch all sunlight errors if you really really need to
(not that you should)
"""
def __init__(self, value):
"""
This is just your basic __init__ method, nothing special here.
Args:
value (str): Message to report with the Exception
"""
self.value = value
def __str__(self):
"""
Return the string-ular representation of the exception - this makes it
super easy to just run something like ``print e`` (given ``e`` is a
SunlightException instance)
"""
return repr(self.value)
class BadRequestException(SunlightException):
"""
This gets thrown when the underlying url request has recieved an abnormal
response code, or the program has issued a request that can not be filled.
"""
pass
class InvalidRequestException(BadRequestException):
"""
This gets thrown when the API gets a valid response, but has an error that
should be passed back to the program.
"""
pass
class NoAPIKeyException(SunlightException):
"""
This gets thrown if the bindings are asked to issue a request, but the
``sunlight.config.API_KEY`` variable is ``None``.
"""
pass
|