1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-22 22:32:19 +01:00
pywb/pywb/wbexceptions.py
Ilya Kreymer d9930322f1 support utf-8 (so far)
support protocol-agnostic prefix //
failedFile list for warc loading
2013-12-31 00:18:12 +00:00

59 lines
1.5 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__(self, msg, errList = None):
super(InvalidArchiveRecordException, self).__init__(msg)
self.errList = errList
class ArchiveLoadFailed(CaptureException):
def __init__(self, filename, reason):
super(ArchiveLoadFailed, self).__init__(filename + ':' + str(reason))
self.filename = filename
self.reason = reason
def status(_):
return '503'
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