osbuild.py: make StageFailed and AssemblerFailed consistent
This way they can both be used as ducks in an exception handler.
This commit is contained in:
parent
baa5da6abe
commit
781fc73176
2 changed files with 6 additions and 6 deletions
4
osbuild
4
osbuild
|
|
@ -34,7 +34,7 @@ if __name__ == "__main__":
|
|||
print()
|
||||
print(f"{RESET}{BOLD}{RED}Aborted{RESET}")
|
||||
sys.exit(130)
|
||||
except osbuild.StageFailed as error:
|
||||
except (osbuild.StageFailed, osbuild.AssemblerFailed) as error:
|
||||
print()
|
||||
print(f"{RESET}{BOLD}{RED}{error.stage} failed with code {error.returncode}{RESET}")
|
||||
print(f"{RESET}{BOLD}{RED}{error.name} failed with code {error.returncode}{RESET}")
|
||||
sys.exit(1)
|
||||
|
|
|
|||
|
|
@ -30,15 +30,15 @@ if not os.path.exists(f"{libdir}/stages"):
|
|||
|
||||
|
||||
class StageFailed(Exception):
|
||||
def __init__(self, stage, returncode, output):
|
||||
self.stage = stage
|
||||
def __init__(self, name, returncode, output):
|
||||
self.name = name
|
||||
self.returncode = returncode
|
||||
self.output = output
|
||||
|
||||
|
||||
class AssemblerFailed(Exception):
|
||||
def __init__(self, assembler, returncode, output):
|
||||
self.assembler = assembler
|
||||
def __init__(self, name, returncode, output):
|
||||
self.name = name
|
||||
self.returncode = returncode
|
||||
self.output = output
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue