Skip to content

Commit

Permalink
Merge pull request #1197 from eqlabs/extend_py_errs
Browse files Browse the repository at this point in the history
feat: increase python error message limit
  • Loading branch information
Mirko-von-Leipzig authored Jul 7, 2023
2 parents e15ee36 + df740c7 commit 014f6fb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions py/src/pathfinder_worker/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ def do_loop(connection: sqlite3.Connection, input_gen, output_file):
command = line
timings = {}

# Error message character limit. A simple contract error message is ~3000,
# so 50 000 feels like a reasonable limit for more complex call stacks.
MSG_LIMIT = 50_000

try:
command = Command.Schema().loads(line)

Expand Down Expand Up @@ -395,8 +399,8 @@ def do_loop(connection: sqlite3.Connection, input_gen, output_file):

if exc.message:
message = exc.message
if len(message) > 200:
message = message[:197] + "..."
if len(message) > MSG_LIMIT:
message = message[:MSG_LIMIT] + "..."
exception_message = f"{exc.code}: {message}"
else:
exception_message = str(exc.code)
Expand All @@ -405,8 +409,8 @@ def do_loop(connection: sqlite3.Connection, input_gen, output_file):
except Exception as exc:
stringified = str(exc)

if len(stringified) > 200:
stringified = stringified[:197] + "..."
if len(message) > MSG_LIMIT:
message = message[:MSG_LIMIT] + "..."
report_failed(logger, command, exc)
out = {"status": "failed", "exception": stringified}
finally:
Expand Down

0 comments on commit 014f6fb

Please sign in to comment.