-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from DataONEorg/feature-109-verifyobj-update
Feature-109: `verify_object` Update
- Loading branch information
Showing
7 changed files
with
347 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
"""FileHashStore custom exception module.""" | ||
|
||
|
||
class CidRefsContentError(Exception): | ||
"""Custom exception thrown when verifying reference files and a cid refs | ||
file does not have a pid that is expected to be found.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class CidRefsFileNotFound(Exception): | ||
"""Custom exception thrown when verifying reference files and a cid refs | ||
file is not found.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class CidRefsDoesNotExist(Exception): | ||
"""Custom exception thrown when a cid refs file does not exist.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class PidRefsContentError(Exception): | ||
"""Custom exception thrown when verifying reference files and a pid refs | ||
file does not contain the cid that it is expected.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class PidRefsFileNotFound(Exception): | ||
"""Custom exception thrown when verifying reference files and a pid refs | ||
file is not found.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class PidAlreadyExistsError(Exception): | ||
"""Custom exception thrown when a client calls 'tag_object' and the pid | ||
that is being tagged is already accounted for (has a pid refs file and | ||
is found in the cid refs file).""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class PidRefsDoesNotExist(Exception): | ||
"""Custom exception thrown when a pid refs file does not exist.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class PidNotFoundInCidRefsFile(Exception): | ||
"""Custom exception thrown when pid reference file exists with a cid, but | ||
the respective cid reference file does not contain the pid.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class NonMatchingObjSize(Exception): | ||
"""Custom exception thrown when verifying an object and the expected file size | ||
does not match what has been calculated.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class NonMatchingChecksum(Exception): | ||
"""Custom exception thrown when verifying an object and the expected checksum | ||
does not match what has been calculated.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class RefsFileExistsButCidObjMissing(Exception): | ||
"""Custom exception thrown when pid and cid refs file exists, but the | ||
cid object does not.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors | ||
|
||
|
||
class UnsupportedAlgorithm(Exception): | ||
"""Custom exception thrown when a given algorithm is not supported in HashStore for | ||
calculating hashes/checksums, as the default store algo and/or other operations.""" | ||
|
||
def __init__(self, message, errors=None): | ||
super().__init__(message) | ||
self.errors = errors |
Oops, something went wrong.