summaryrefslogtreecommitdiffstats
path: root/gallery_dl/exception.py
blob: 3e86177c67086ed48cb3278006fd5be173c4b92a (plain) (blame)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-

# Copyright 2015-2018 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.

"""Exception classes used by gallery-dl

Class Hierarchy:

Exception
 +-- GalleryDLException
      +-- ExtractionError
      |    +-- AuthenticationError
      |    +-- AuthorizationError
      |    +-- NotFoundError
      |    +-- HttpError
      +-- DownloadError
      |    +-- DownloadComplete
      |    +-- DownloadRetry
      +-- NoExtractorError
      +-- FormatError
      +-- FilterError
      +-- StopExtraction
"""


class GalleryDLException(Exception):
    """Base class for GalleryDL exceptions"""


class ExtractionError(GalleryDLException):
    """Base class for exceptions during information extraction"""


class AuthenticationError(ExtractionError):
    """Invalid or missing login information"""


class AuthorizationError(ExtractionError):
    """Insufficient privileges to access a resource"""


class NotFoundError(ExtractionError):
    """Requested resource (gallery/image) does not exist"""


class HttpError(ExtractionError):
    """HTTP request during extraction failed"""


class DownloadError(GalleryDLException):
    """Base class for exceptions during file downloads"""


class DownloadRetry(DownloadError):
    """Download attempt failed and should be retried"""


class DownloadComplete(DownloadError):
    """Output file of attempted download is already complete"""


class NoExtractorError(GalleryDLException):
    """No extractor can handle the given URL"""


class FormatError(GalleryDLException):
    """Error while building output path"""


class FilterError(GalleryDLException):
    """Error while evaluating a filter expression"""


class StopExtraction(GalleryDLException):
    """Extraction should stop"""