mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-12 15:46:15 +01:00
Add PackageError.__str__() so we can also use it in the inherited classes
This commit is contained in:
parent
175a44bc97
commit
c7370522cc
@ -120,28 +120,30 @@ class WorkingCopyOutdated(OscBaseError):
|
|||||||
class PackageError(OscBaseError):
|
class PackageError(OscBaseError):
|
||||||
"""Base class for all Package related exceptions"""
|
"""Base class for all Package related exceptions"""
|
||||||
|
|
||||||
def __init__(self, prj, pac):
|
def __init__(self, prj, pac, msg=None):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.prj = prj
|
self.prj = prj
|
||||||
self.pac = pac
|
self.pac = pac
|
||||||
|
self.msg = msg
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
result = f"{self.__class__.__name__}: {self.prj}/{self.pac}"
|
||||||
|
if self.msg:
|
||||||
|
result += f": {self.msg}"
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
class WorkingCopyInconsistent(PackageError):
|
class WorkingCopyInconsistent(PackageError):
|
||||||
"""Exception raised when the working copy is in an inconsistent state"""
|
"""Exception raised when the working copy is in an inconsistent state"""
|
||||||
|
|
||||||
def __init__(self, prj, pac, dirty_files, msg):
|
def __init__(self, prj, pac, dirty_files, msg):
|
||||||
super().__init__(prj, pac)
|
super().__init__(prj, pac, msg)
|
||||||
self.dirty_files = dirty_files
|
self.dirty_files = dirty_files
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
|
|
||||||
class LinkExpandError(PackageError):
|
class LinkExpandError(PackageError):
|
||||||
"""Exception raised when source link expansion fails"""
|
"""Exception raised when source link expansion fails"""
|
||||||
|
|
||||||
def __init__(self, prj, pac, msg):
|
|
||||||
super().__init__(prj, pac)
|
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
|
|
||||||
class OscIOError(OscBaseError):
|
class OscIOError(OscBaseError):
|
||||||
def __init__(self, e, msg):
|
def __init__(self, e, msg):
|
||||||
@ -187,20 +189,12 @@ class PackageExists(PackageError):
|
|||||||
Exception raised when a local object already exists
|
Exception raised when a local object already exists
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, prj, pac, msg):
|
|
||||||
super().__init__(prj, pac)
|
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
|
|
||||||
class PackageMissing(PackageError):
|
class PackageMissing(PackageError):
|
||||||
"""
|
"""
|
||||||
Exception raised when a local object doesn't exist
|
Exception raised when a local object doesn't exist
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, prj, pac, msg):
|
|
||||||
super().__init__(prj, pac)
|
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
|
|
||||||
class PackageFileConflict(PackageError):
|
class PackageFileConflict(PackageError):
|
||||||
"""
|
"""
|
||||||
@ -209,13 +203,12 @@ class PackageFileConflict(PackageError):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, prj, pac, file, msg):
|
def __init__(self, prj, pac, file, msg):
|
||||||
super().__init__(prj, pac)
|
super().__init__(prj, pac, msg)
|
||||||
self.file = file
|
self.file = file
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
|
|
||||||
class PackageInternalError(PackageError):
|
class PackageInternalError(PackageError):
|
||||||
def __init__(self, prj, pac, msg):
|
pass
|
||||||
super().__init__(prj, pac)
|
|
||||||
self.msg = msg
|
|
||||||
# vim: sw=4 et
|
# vim: sw=4 et
|
||||||
|
Loading…
Reference in New Issue
Block a user