File: exceptions.py

package info (click to toggle)
python-flickrapi 2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 468 kB
  • sloc: python: 2,145; makefile: 147; sh: 10
file content (44 lines) | stat: -rw-r--r-- 1,087 bytes parent folder | download
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
"""Exceptions used by the FlickrAPI module."""


class IllegalArgumentException(ValueError):
    """Raised when a method is passed an illegal argument.

    More specific details will be included in the exception message
    when thrown.
    """


class FlickrError(Exception):
    """Raised when a Flickr method fails.

    More specific details will be included in the exception message
    when thrown.
    """

    def __init__(self, message, code=None):
        Exception.__init__(self, message)

        if code is None:
            self.code = None
        else:
            self.code = int(code)


class CancelUpload(Exception):
    """Raise this exception in an upload/replace callback function to
    abort the upload.
    """


class LockingError(Exception):
    """Raised when TokenCache cannot acquire a lock within the timeout
    period, or when a lock release is attempted when the lock does not
    belong to this process.
    """


class CacheDatabaseError(FlickrError):
    """Raised when the OAuth token cache database is corrupted
    or otherwise unusable.
    """