Skip to content

Commit

Permalink
Remove obsolete exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Puehringer <[email protected]>
  • Loading branch information
lukpueh committed Apr 9, 2024
1 parent 8be956a commit 0640f09
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 142 deletions.
83 changes: 0 additions & 83 deletions securesystemslib/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,93 +22,18 @@ class Error(Exception):
"""Indicate a generic error."""


class Warning(Warning): # pylint: disable=redefined-builtin
"""Generic warning. It is used by the 'warnings' module."""


class FormatError(Error):
"""Indicate an error while validating an object's format."""


class InvalidMetadataJSONError(FormatError):
"""Indicate that a metadata file is not valid JSON."""

def __init__(self, exception): # pylint: disable=super-init-not-called
# Store the original exception.
self.exception = exception

def __str__(self):
# Show the original exception.
return repr(self.exception)


class UnsupportedAlgorithmError(Error):
"""Indicate an error while trying to identify a user-specified algorithm."""


class BadHashError(Error):
"""Indicate an error while checking the value a hash object."""

def __init__(
self, expected_hash, observed_hash
): # pylint: disable=super-init-not-called
self.expected_hash = expected_hash
self.observed_hash = observed_hash

def __str__(self):
return (
"Observed hash ("
+ repr(self.observed_hash)
+ ") != expected hash ("
+ repr(self.expected_hash)
+ ")"
)


class BadPasswordError(Error):
"""Indicate an error after encountering an invalid password."""


class CryptoError(Error):
"""Indicate any cryptography-related errors."""


class BadSignatureError(CryptoError):
"""Indicate that some metadata has a bad signature."""

def __init__(
self, metadata_role_name
): # pylint: disable=super-init-not-called
self.metadata_role_name = metadata_role_name

def __str__(self):
return repr(self.metadata_role_name) + " metadata has bad signature."


class UnknownMethodError(CryptoError):
"""Indicate that a user-specified cryptograpthic method is unknown."""


class UnsupportedLibraryError(Error):
"""Indicate that a supported library could not be located or imported."""


class InvalidNameError(Error):
"""Indicate an error while trying to validate any type of named object."""


class NotFoundError(Error):
"""If a required configuration or resource is not found."""


class URLMatchesNoPatternError(Error):
"""If a URL does not match a user-specified regular expression."""


class InvalidConfigurationError(Error):
"""If a configuration object does not match the expected format."""


class StorageError(Error):
"""Indicate an error occured during interaction with an abstracted storage
backend."""
Expand All @@ -121,11 +46,3 @@ class UnverifiedSignatureError(Error):

class VerificationError(UnverifiedSignatureError):
"""Signature could not be verified because something failed in the process"""


class SerializationError(Error):
"""Error during serialization."""


class DeserializationError(Error):
"""Error during deserialization."""
59 changes: 0 additions & 59 deletions tests/test_exceptions.py

This file was deleted.

0 comments on commit 0640f09

Please sign in to comment.