Better message when we fail to pack/unpack an executable.

This commit is contained in:
Jennifer Taylor 2019-06-25 20:56:08 +00:00
parent dae5eb5a07
commit 6b43e078f1
1 changed files with 10 additions and 2 deletions

View File

@ -62,7 +62,11 @@ def main() -> int:
with open(binfile, "rb") as fp:
data = fp.read()
packed = FirebeatExe.raw_to_exe(data, is_ppp=args.ppp)
try:
packed = FirebeatExe.raw_to_exe(data, is_ppp=args.ppp)
except Exception:
print(f"Failed to pack {binfile}.")
return 1
with open(exefile, "wb") as fp:
fp.write(packed)
@ -75,7 +79,11 @@ def main() -> int:
with open(exefile, "rb") as fp:
data = fp.read()
unpacked = FirebeatExe.exe_to_raw(data, is_ppp=args.ppp)
try:
unpacked = FirebeatExe.exe_to_raw(data, is_ppp=args.ppp)
except Exception:
print(f"Failed to unpack {exefile}.")
return 1
with open(binfile, "wb") as fp:
fp.write(unpacked)