Skip to content

Commit

Permalink
remove exit on error, do that manually instead
Browse files Browse the repository at this point in the history
  • Loading branch information
itsnebulalol committed Aug 30, 2022
1 parent 956835d commit a8da4ab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion permasigner/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def debug(message, dbg):

def error(message):
print(colors["lightred"] + colors["bold"] + "[!] " + colors["reset"] + colors["lightred"] + f"{message}" + colors["reset"])
exit(1)


def ask(message):
Expand Down
4 changes: 4 additions & 0 deletions permasigner/permasigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def main(self) -> None:
if self.args.url:
if not self.args.url.endswith(".ipa"):
logger.error("URL provided is not an IPA, make sure to provide a direct link.")
exit(1)

print(f"Downloading IPA from {self.args.url}...")
save_path = self.download_ipa()
Expand Down Expand Up @@ -140,6 +141,7 @@ def permasign(self) -> Path:
# then, exit with an error
else:
logger.error("Unable to find Info.plist, can't read application data")
exit(1)

# Create directories in tmp dir
logger.log(f"Making deb directories...", color=colors["yellow"])
Expand Down Expand Up @@ -263,8 +265,10 @@ def download_ipa(self) -> Path:
return save_path
else:
logger.error(f"Provided URL is not reachable. Status code: {res.status_code}")
exit(1)
except (NewConnectionError, ConnectionError, RequestException) as err:
logger.error(f"Provided URL is not reachable. Error: {err}")
exit(1)

def extract_ipa(self, src: Path) -> None:
# Extracts ipa to folder in tmp
Expand Down
1 change: 1 addition & 0 deletions permasigner/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def download(self) -> None:
color=colors["yellow"])
else:
logger.error('Download url is not reachable, and no ldid found in path, exiting.')
exit(1)
# If hashes do not match but the content is not empty, save it to a file
else:
logger.debug(f"Ldid hash failed to verify, saving newer version", self.args.debug)
Expand Down
2 changes: 2 additions & 0 deletions permasigner/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ def find_application_bundle(tmp: Path) -> Union[Path, str]:

if bundle == '':
logger.error("Did not find application bundle")
exit(1)
else:
logger.error(f"IPA/deb is not valid!")
exit(1)

return bundle

Expand Down

0 comments on commit a8da4ab

Please sign in to comment.