Source code for browsepy.exceptions
[docs]class OutsideDirectoryBase(Exception):
'''
Exception raised when trying to access to a file outside path defined on
`directory_base` config property.
'''
pass
[docs]class OutsideRemovableBase(Exception):
'''
Exception raised when trying to access to a file outside path defined on
`directory_remove` config property.
'''
pass
[docs]class InvalidPathError(ValueError):
'''
Exception raised when a path is not valid.
:property path: value whose length raised this Exception
'''
code = 'invalid-path'
template = 'Path {0.path!r} is not valid.'
def __init__(self, message=None, path=None):
self.path = path
message = self.template.format(self) if message is None else message
super(InvalidPathError, self).__init__(message)
[docs]class InvalidFilenameError(InvalidPathError):
'''
Exception raised when a filename is not valid.
:property filename: value whose length raised this Exception
'''
code = 'invalid-filename'
template = 'Filename {0.filename!r} is not valid.'
def __init__(self, message=None, path=None, filename=None):
self.filename = filename
super(InvalidFilenameError, self).__init__(message, path=path)