-
-
Notifications
You must be signed in to change notification settings - Fork 43.2k
Description
Is your feature request related to a problem? Please describe.
Currently, when a learner encounters a runtime error (traceback) while running code in Python-based challenges (Python, Multifile Python, PyLab), the error is only printed to the terminal (Xterm). However, in JavaScript challenges, such errors are also proxied to the main challenge console (the error pane in the UI). There is an existing TODO in client/src/templates/Challenges/redux/execute-challenge-saga.js specifically addressing this: // TODO: proxy errors to the console.
Describe the solution you'd like
I would like Python runtime errors to be caught in the Python worker and emitted as a distinct event that the main platform logic (Redux Saga) can subscribe to and display in the main console.
Implementation details:
- Refactor python-worker-handler.ts from a single-listener model (via registerTerminal) to a multi-listener event emitter pattern.
- Update the Python worker script to emit an error event with the formatted traceback.
- Update execute-challenge-saga.js to subscribe to these events and dispatch updateConsole.
Describe alternatives you've considered
Leaving the errors only in the terminal, but this is inconsistent with the learner experience on other challenge types and overlooks a planned architectural improvement.
Additional context
I have an implementation ready that addresses this by refactoring the worker handler to be more flexible, which also improves the codebase's extensibility for future worker events.
Related Pull Request: #65481