Skip to content

Commit

Permalink
feat: Add script error checking to log reader (#59)
Browse files Browse the repository at this point in the history
Checks logs for mention of `SCRIPT ERROR` and prints corresponding lines.
  • Loading branch information
Bobbyperson authored Sep 26, 2024
1 parent a52d401 commit 0a102b1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions reaper/cogs/log_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ async def on_message(self, message):
double_barrel_crash = False
mod_problem = False
invalid_value = False
script_error = []
crash_counter = 0
filename = None
audio_list = []
Expand Down Expand Up @@ -243,6 +244,22 @@ async def on_message(self, message):
problem_found = True
framework_error = True

elif "SCRIPT ERROR" in line:
dm_log.add_field(
name="",
value="SCRIPT ERROR: True",
inline=False,
)
logger.info("I found a script error!")
problem_found = True
j = i
script_read_failsafe = 15
while lines[j] != "" and j < i + script_read_failsafe:
# script traceback ends with a blank line, 15 is just a failsafe
script_error.append(lines[j])
logger.info(lines[j])
j += 1

elif (
'Failed reading masterserver authentication response: encountered parse error "Invalid value."'
in line
Expand Down Expand Up @@ -428,6 +445,14 @@ async def on_message(self, message):
inline=False,
)

if script_error:
logger.info("adding field")
problem.add_field(
name="Script Error",
value=f"The following script error was found: \n ```{'\n'.join(script_error)}```\nYou likely have an old or outdated mod. You can try to find it based on the files listed in this part of the log and delete it, or wait for a human to give you more information.",
inline=False,
)

if mod_problem:
if double_barrel_crash:

Expand Down

0 comments on commit 0a102b1

Please sign in to comment.