Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/exc.py
Show All 15 Lines | |||||
class ObjStorageAPIError(Exception): | class ObjStorageAPIError(Exception): | ||||
""" Specific internal exception of an object storage (mainly connection). | """ Specific internal exception of an object storage (mainly connection). | ||||
""" | """ | ||||
def __str__(self): | def __str__(self): | ||||
args = self.args | args = self.args | ||||
return "An unexpected error occurred in the api backend: %s" % args | return "An unexpected error occurred in the api backend: %s" % args | ||||
class ReadOnlyObjStorage(Error): | |||||
def __init__(self, method, *args): | |||||
super().__init__(*args) | |||||
self.method = method | |||||
def __str__(self): | |||||
return "This object storage is Read-Only: cannot use %s" % self.method | |||||
class NonIterableObjStorage(Error): | |||||
def __init__(self, method, *args): | |||||
super().__init__(*args) | |||||
self.method = method | |||||
def __str__(self): | |||||
return "This object storage is not iterable: cannot use %s" % self.method |