Skip to content

Commit

Permalink
Add safe guards for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
khronokernel committed Jun 2, 2023
1 parent 1ef98e0 commit cada66a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resources/analytics_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def send_crash_report(self, log_file: Path) -> None:
return
if not log_file.exists():
return
if self.constants.commit_info[0].startswith("refs/tags"):
# Avoid being overloaded with crash reports
return

commit_info = self.constants.commit_info[0].split("/")[-1] + "_" + self.constants.commit_info[1].split("T")[0] + "_" + self.constants.commit_info[2].split("/")[-1]

Expand Down
4 changes: 4 additions & 0 deletions resources/logging_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ def custom_excepthook(type, value, tb) -> None:
error_msg += f"\n\n{traceback.extract_tb(tb)[-1]}"

cant_log: bool = global_settings.GlobalEnviromentSettings().read_property("DisableCrashAndAnalyticsReporting")
if not isinstance(cant_log, bool):
cant_log = False

if self.constants.commit_info[0].startswith("refs/tags"):
cant_log = True

if cant_log is True:
error_msg += "\n\nReveal log file?"
Expand Down

0 comments on commit cada66a

Please sign in to comment.