Skip to content

Commit

Permalink
refactor: rename exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
afuetterer committed Nov 12, 2023
1 parent 927dbd4 commit 0de3f7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/oaipmh_scythe/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@
"""Custom exceptions for OAI-PMH related errors."""


class OAIPMHError(Exception):
class OAIPMHException(Exception):
"""Base exception for all OAI-PMH related errors."""


class BadArgument(OAIPMHError):
class BadArgument(OAIPMHException):
"""The request includes illegal arguments, is missing required arguments, includes a repeated argument,
or values for arguments have an illegal syntax."""


class BadVerb(OAIPMHError):
class BadVerb(OAIPMHException):
"""Value of the verb argument is not a legal OAI-PMH verb, the verb argument is missing,
or the verb argument is repeated."""


class BadResumptionToken(OAIPMHError):
class BadResumptionToken(OAIPMHException):
"""The value of the resumptionToken argument is invalid or expired."""


class CannotDisseminateFormat(OAIPMHError):
class CannotDisseminateFormat(OAIPMHException):
"""The metadata format identified by the value given for the metadataPrefix argument
is not supported by the item or by the repository."""


class IdDoesNotExist(OAIPMHError):
class IdDoesNotExist(OAIPMHException):
"""The value of the identifier argument is unknown or illegal in this repository."""


class NoSetHierarchy(OAIPMHError):
class NoSetHierarchy(OAIPMHException):
"""The repository does not support sets."""


class NoMetadataFormat(OAIPMHError):
class NoMetadataFormat(OAIPMHException):
"""There are no metadata formats available for the specified item."""


class NoRecordsMatch(OAIPMHError):
class NoRecordsMatch(OAIPMHException):
"""The combination of the values of the from, until, set and metadataPrefix arguments results in an empty list."""


class OAIError(OAIPMHError):
"""Context specific OAI errors not covered by the classes above."""
class GeneralOAIPMHError(OAIPMHException):
"""General exception for context-specific OAI-PMH errors not covered by the other specific classes."""
2 changes: 1 addition & 1 deletion src/oaipmh_scythe/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _next_response(self) -> None:
exception_name = code[0].upper() + code[1:]
raise getattr(exceptions, exception_name)(description)
except AttributeError as exc:
raise exceptions.OAIError(description) from exc
raise exceptions.GeneralOAIPMHError(description) from exc
self.resumption_token = self._get_resumption_token()


Expand Down

0 comments on commit 0de3f7b

Please sign in to comment.