@@ -68,7 +68,11 @@ class UnsupportedAlgorithmError(Error):
6868class LengthOrHashMismatchError (Error ):
6969 """Indicate an error while checking the length and hash values of an object"""
7070
71- class BadHashError (Error ):
71+ class RepositoryError (Error ):
72+ """Indicate an error with a repository's state, such as a missing file."""
73+
74+
75+ class BadHashError (RepositoryError ):
7276 """Indicate an error while checking the value of a hash object."""
7377
7478 def __init__ (self , expected_hash , observed_hash ):
@@ -90,9 +94,6 @@ def __repr__(self):
9094 # self.__class__.__name__ + '(' + repr(self.expected_hash) + ', ' +
9195 # repr(self.observed_hash) + ')')
9296
93- class BadVersionNumberError (Error ):
94- """Indicate an error for metadata that contains an invalid version number."""
95-
9697
9798class BadPasswordError (Error ):
9899 """Indicate an error after encountering an invalid password."""
@@ -102,8 +103,8 @@ class UnknownKeyError(Error):
102103 """Indicate an error while verifying key-like objects (e.g., keyids)."""
103104
104105
105- class RepositoryError ( Error ):
106- """Indicate an error with a repository's state, such as a missing file ."""
106+ class BadVersionNumberError ( RepositoryError ):
107+ """Indicate an error for metadata that contains an invalid version number ."""
107108
108109
109110class MissingLocalRepositoryError (RepositoryError ):
@@ -118,36 +119,29 @@ class ForbiddenTargetError(RepositoryError):
118119 """Indicate that a role signed for a target that it was not delegated to."""
119120
120121
121- class ExpiredMetadataError (Error ):
122+ class ExpiredMetadataError (RepositoryError ):
122123 """Indicate that a TUF Metadata file has expired."""
123124
124125
125126class ReplayedMetadataError (RepositoryError ):
126127 """Indicate that some metadata has been replayed to the client."""
127128
128- def __init__ (self , metadata_role , previous_version , current_version ):
129+ def __init__ (self , metadata_role , downloaded_version , current_version ):
129130 super (ReplayedMetadataError , self ).__init__ ()
130131
131132 self .metadata_role = metadata_role
132- self .previous_version = previous_version
133+ self .downloaded_version = downloaded_version
133134 self .current_version = current_version
134135
135-
136136 def __str__ (self ):
137137 return (
138138 'Downloaded ' + repr (self .metadata_role ) + ' is older (' +
139- repr (self .previous_version ) + ') than the version currently '
139+ repr (self .downloaded_version ) + ') than the version currently '
140140 'installed (' + repr (self .current_version ) + ').' )
141141
142142 def __repr__ (self ):
143143 return self .__class__ .__name__ + ' : ' + str (self )
144144
145- # # Directly instance-reproducing:
146- # return (
147- # self.__class__.__name__ + '(' + repr(self.metadata_role) + ', ' +
148- # repr(self.previous_version) + ', ' + repr(self.current_version) + ')')
149-
150-
151145
152146class CryptoError (Error ):
153147 """Indicate any cryptography-related errors."""
@@ -249,7 +243,7 @@ class InvalidNameError(Error):
249243 """Indicate an error while trying to validate any type of named object."""
250244
251245
252- class UnsignedMetadataError (Error ):
246+ class UnsignedMetadataError (RepositoryError ):
253247 """Indicate metadata object with insufficient threshold of signatures."""
254248
255249 def __init__ (self , message , signable ):
0 commit comments