2015-12-12 00:11:05 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2017-02-23 21:51:29 +01:00
|
|
|
# Copyright 2015-2017 Mike Fährmann
|
2015-12-12 00:11:05 +01:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2017-08-05 16:11:46 +02:00
|
|
|
"""Exception classes used by gallery-dl
|
2017-01-30 19:40:15 +01:00
|
|
|
|
2017-08-05 16:11:46 +02:00
|
|
|
Class Hierarchy:
|
|
|
|
|
|
|
|
Exception
|
|
|
|
+-- GalleryDLException
|
|
|
|
+-- ExtractionError
|
|
|
|
| +-- AuthenticationError
|
|
|
|
| +-- AuthorizationError
|
|
|
|
| +-- NotFoundError
|
|
|
|
| +-- HttpError
|
2017-11-10 21:35:53 +01:00
|
|
|
+-- DownloadError
|
|
|
|
+-- DownloadComplete
|
2017-08-05 16:11:46 +02:00
|
|
|
+-- NoExtractorError
|
2017-08-11 21:48:37 +02:00
|
|
|
+-- FormatError
|
2017-09-08 17:52:00 +02:00
|
|
|
+-- FilterError
|
2017-08-05 16:11:46 +02:00
|
|
|
+-- StopExtraction
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class GalleryDLException(Exception):
|
|
|
|
"""Base class for GalleryDL exceptions"""
|
|
|
|
|
|
|
|
|
|
|
|
class ExtractionError(GalleryDLException):
|
|
|
|
"""Base class for exceptions during information extraction"""
|
2016-07-14 14:57:42 +02:00
|
|
|
|
2017-01-30 19:40:15 +01:00
|
|
|
|
2017-08-05 16:11:46 +02:00
|
|
|
class AuthenticationError(ExtractionError):
|
2016-08-27 17:39:45 +02:00
|
|
|
"""Invalid or missing login information"""
|
|
|
|
|
2017-01-30 19:40:15 +01:00
|
|
|
|
2017-08-05 16:11:46 +02:00
|
|
|
class AuthorizationError(ExtractionError):
|
2016-09-24 13:26:19 +02:00
|
|
|
"""Insufficient privileges to access a resource"""
|
|
|
|
|
2017-01-30 19:40:15 +01:00
|
|
|
|
2017-08-05 16:11:46 +02:00
|
|
|
class NotFoundError(ExtractionError):
|
2016-08-27 17:39:45 +02:00
|
|
|
"""Requested resource (gallery/image) does not exist"""
|
2017-02-23 21:51:29 +01:00
|
|
|
|
|
|
|
|
2017-08-05 16:11:46 +02:00
|
|
|
class HttpError(ExtractionError):
|
|
|
|
"""HTTP request during extraction failed"""
|
|
|
|
|
|
|
|
|
2017-12-06 22:35:05 +01:00
|
|
|
class DownloadRetry(GalleryDLException):
|
|
|
|
"""Download attempt failed and should be retried"""
|
2017-11-10 21:35:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
class DownloadComplete(GalleryDLException):
|
|
|
|
"""Output file of attempted download is already complete"""
|
|
|
|
|
|
|
|
|
2017-08-05 16:11:46 +02:00
|
|
|
class NoExtractorError(GalleryDLException):
|
|
|
|
"""No extractor can handle the given URL"""
|
|
|
|
|
|
|
|
|
2017-08-11 21:48:37 +02:00
|
|
|
class FormatError(GalleryDLException):
|
|
|
|
"""Error while building output path"""
|
|
|
|
|
|
|
|
|
2017-09-08 17:52:00 +02:00
|
|
|
class FilterError(GalleryDLException):
|
|
|
|
"""Error while evaluating a filter expression"""
|
|
|
|
|
|
|
|
|
2017-08-05 16:11:46 +02:00
|
|
|
class StopExtraction(GalleryDLException):
|
2017-02-23 21:51:29 +01:00
|
|
|
"""Extraction should stop"""
|