8000 Proxy Python execution errors to the main platform console · Issue #65482 · freeCodeCamp/freeCodeCamp · GitHub
[go: up one dir, main page]

Skip to content

Proxy Python execution errors to the main platform console #65482

@vinDelphini

Description

@vinDelphini

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedOpen for all. You do not need permission to work on these.platform: learnUI side of the client application that needs familiarity with React, Gatsby etc.python v9 certThese are for issues dealing with the Python V9 certification.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0