Skip to content

Commit

Permalink
Problem: IGNORE_TRACEBACK_FROM_DIAGNOSTICS broken
Browse files Browse the repository at this point in the history
Symptom:
The CustomError from the diagnostics VM was printed even if if IGNORE_TRACEBACK_FROM_DIAGNOSTICS was set to True (the default)

Analysis:
This was caused by the refactoring of the fastapi_example/main.py file
done in fe9235a
Which changed the output used to detect the error to catch

Solution:
Fix detection string
  • Loading branch information
olethanh committed Oct 28, 2024
1 parent 123a4d8 commit e259b25
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/aleph/vm/orchestrator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ async def run_code_on_request(vm_hash: ItemHash, path: str, pool: VmPool, reques

# The Diagnostics VM checks for the proper handling of exceptions.
# This fills the logs with noisy stack traces, so we ignore this specific error.
ignored_error = 'raise CustomError("Whoops")'
ignored_errors = ['raise CustomError("Whoops")', "main.CustomError: Whoops"]

Check warning on line 153 in src/aleph/vm/orchestrator/run.py

View check run for this annotation

Codecov / codecov/patch

src/aleph/vm/orchestrator/run.py#L153

Added line #L153 was not covered by tests

if settings.IGNORE_TRACEBACK_FROM_DIAGNOSTICS and ignored_error in result["traceback"]:
if settings.IGNORE_TRACEBACK_FROM_DIAGNOSTICS and any(
ignored_error in result["traceback"] for ignored_error in ignored_errors
):
logger.debug('Ignored traceback from CustomError("Whoops")')
else:
logger.warning(result["traceback"])
Expand Down

0 comments on commit e259b25

Please sign in to comment.