Skip to content

Commit

Permalink
Prevent the bot from stopping without giving any reason.
Browse files Browse the repository at this point in the history
Fixes 40Cakes#116

If the stats system cannot initialise for some reason, it catches _all_ errors, suppresses them and then just exits the process.

Most of the time that probably happened due to messed up `custom_hooks` or `custom_catch_filters` files (containing syntax errors or other problems that manifest on import.)

I have removed that catch-all handler entirely since Python's default behaviour should already be to just exit whenever there is an exception -- but at least now, there will be an error message.

I have searched the code base for similar snippets and found another one in `write_symbol()`, which I have also updated.
  • Loading branch information
hanzi committed Dec 1, 2023
1 parent 19f1d5e commit f74c17c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
3 changes: 0 additions & 3 deletions modules/memory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import struct
from enum import IntEnum

Expand Down Expand Up @@ -67,8 +66,6 @@ def write_symbol(name: str, data: bytes, offset: int = 0x0) -> bool:
return True
except SystemExit:
raise
except:
sys.exit(1)


def parse_tasks(pretty_names: bool = False) -> list:
Expand Down
3 changes: 0 additions & 3 deletions modules/stats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import copy
import json
import math
import sys
import time
import importlib
from threading import Thread
Expand Down Expand Up @@ -60,8 +59,6 @@ def __init__(self):
self.shiny_log = json.loads(f_shiny_log) if f_shiny_log else {"shiny_log": []}
except SystemExit:
raise
except:
sys.exit(1)

def append_encounter_timestamps(self) -> None:
self.encounter_timestamps.append(time.time())
Expand Down

0 comments on commit f74c17c

Please sign in to comment.