improve 'extractor.request'

- add 'fatal' argument
- improve internal logic and flow
- raise known exception on error
- update exception hierarchy
This commit is contained in:
Mike Fährmann
2017-08-05 16:11:46 +02:00
parent dcd573806e
commit 915a0137de
12 changed files with 75 additions and 62 deletions

View File

@@ -6,22 +6,49 @@
# 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 NoExtractorError(Exception):
"""No extractor can handle the given URL"""
Class Hierarchy:
Exception
+-- GalleryDLException
+-- ExtractionError
| +-- AuthenticationError
| +-- AuthorizationError
| +-- NotFoundError
| +-- HttpError
+-- NoExtractorError
+-- StopExtraction
"""
class AuthenticationError(Exception):
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(Exception):
class AuthorizationError(ExtractionError):
"""Insufficient privileges to access a resource"""
class NotFoundError(Exception):
class NotFoundError(ExtractionError):
"""Requested resource (gallery/image) does not exist"""
class StopExtraction(Exception):
class HttpError(ExtractionError):
"""HTTP request during extraction failed"""
class NoExtractorError(GalleryDLException):
"""No extractor can handle the given URL"""
class StopExtraction(GalleryDLException):
"""Extraction should stop"""