mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-28 00:25:21 +01:00
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
|
|
class RequestParseException(Exception):
|
|
def status(_):
|
|
return '400'
|
|
|
|
class BadUrlException(Exception):
|
|
def status(_):
|
|
return '400'
|
|
|
|
class AccessException(Exception):
|
|
def status(_):
|
|
return '403'
|
|
|
|
class InvalidCDXException(Exception):
|
|
def status(_):
|
|
return '500'
|
|
|
|
class NotFoundException(Exception):
|
|
def status(_):
|
|
return '404'
|
|
|
|
# Exceptions that effect a specific capture and result in a retry
|
|
class CaptureException(Exception):
|
|
def status(_):
|
|
return '500'
|
|
|
|
class UnresolvedArchiveFileException(CaptureException):
|
|
pass
|
|
|
|
class UnknownArchiveFormatException(CaptureException):
|
|
pass
|
|
|
|
class UnknownLoaderProtocolException(CaptureException):
|
|
pass
|
|
|
|
class InvalidArchiveRecordException(CaptureException):
|
|
def __init__(msg, errList = None):
|
|
super(InvalidArchiveRecordException, self).__init__(msg)
|
|
self.errList = errList
|
|
|
|
class ArchiveLoadFailed(CaptureException):
|
|
pass
|
|
|
|
class InternalRedirect(Exception):
|
|
def __init__(self, location, status = '302 Internal Redirect'):
|
|
Exception.__init__(self, 'Redirecting -> ' + location)
|
|
self.status = status
|
|
self.httpHeaders = [('Location', location)]
|
|
|
|
def status(_):
|
|
return self.status
|
|
|