Python and JavaScript runtime errors show no line number

未关闭
#783 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@onechendong 已经在做这个了。

开始于 2026年11月19日。

  • #853 来自 @onechendong —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

Observed behavior

A Python or JavaScript error raised while the tests run is shown with no line number, so the candidate cannot tell which line failed. In JavaScript the error type is dropped too, and syntax errors also have no line.

The Python answer in Reproduction, whose error is on line 2 inside helper, shows:

FAIL nums=[2,7,11,15], target=9 0ms
input [[2,7,11,15],9]
IndexError: list index out of range

The JavaScript answer, whose error is on line 3, shows:

FAIL nums=[2,7,11,15], target=9 1ms
input [[2,7,11,15],9]
Cannot read properties of undefined (reading 'x')

Across 17 broken answers:

Error Python JavaScript
Runtime error in a test case (index, key, type, None/undefined access, misspelled name, recursion, error inside a helper) type and message, no line message only, no type, no line
Error at top level no line Uncaught ReferenceError: undefinedName is not defined, no line
Syntax error line given, as (<string>, line 4) Uncaught SyntaxError: Unexpected token '{', no line
Expected behavior

The line in the editor where the error was raised, for example:

IndexError: list index out of range (line 2, in helper)
TypeError: Cannot read properties of undefined (reading 'x') (line 3)
Reproduction
  1. Open Chargeback Pair Match, select Python, and replace the editor with:

    def helper(nums, i):
        return nums[i]
    
    class Solution:
        def matchDisputedCharge(self, nums, target):
            a = helper(nums, 0)
            b = helper(nums, 99)
            return [a, b]
    
  2. Click Run tests.

  3. Select JavaScript, replace the editor with:

    function matchDisputedCharge(nums, target) {
      const seen = new Map();
      return nums[100].x;
    }
    
  4. Click Run tests.

  5. For the syntax error, replace line 3 of the JavaScript with if (nums.length > 0 { and run again.

CodeTrial version

codetrial 0.1.0 (288a0c9), built from source

Environment

OS: Windows 11
Browser: Edge 157.0.4341.60
Language: Python, JavaScript
Problem: Chargeback Pair Match

Sanitized evidence

A JavaScript syntax error:

Couldn't run your code
Uncaught SyntaxError: Unexpected token '{'
Cause

The line is available but not used.

  • Python: the driver formats an exception as f"{type(exc).__name__}: {exc}" (web/runners.js:1218, :1276) and ignores exc.__traceback__, which holds the candidate's frames. exec(user_code, ns) (:1216) names the code <string>.
  • JavaScript: the worker keeps error.message (web/runners.js:864) and drops error.name and error.stack. worker.onerror keeps event.message (:935) and drops event.lineno. The candidate's code is the first part of the worker source (:898), so its stack lines are already editor lines.

Related: #217 made C, C++ and Java compile errors cite editor lines; Python and JavaScript errors still cite none.

Questions
  1. Format: is (line N, in function) after the message right, and should the Uncaught prefix and <string> go?
  2. Tests: nothing runs the Python driver today. Should a test run it on CPython from node --test (skipped when python3 is absent), or through Pyodide in scripts/browser-check.sh?
Public data confirmation
  • I removed credentials, session tokens, candidate recordings, and personal interview content from this public report.
主要语言
Rust
星标
236
派生
153
平均合并
1 天 9 小时
30 天内合并 PR
187

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sysprog21/codetrial 的其他 Issue

查看 sysprog21/codetrial 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。