Skip to content

JavaScript: error messages show incorrect source location #1595

@darvld

Description

@darvld

Expected Behavior

When an error occurs during JavaScript/TypeScript execution, the error marker should always be on the line where the error was thrown.

Actual Behaviour

In some cases, the marker will appear on an unrelated line, hiding the actual problem location.

Stacktrace

No response

Steps To Reproduce

Given the following JS source file:

// my-script.js
const http = require("http");

const port = 8000;

http.createServer() // fails because HTTP is not implemented (expected for demo purposes)

Calling elide run ./my-script.js will show the line const port = 8000; as the error location:

║  1┊ const http = require("http");
║  2┊                                               
✗  3┊ const port = 8000;              
╟────────────────────────────────────────────────
║ TypeError: invokeMember (createServer) on elide.runtime.node.http.NodeHttp@62a19df6 failed due to: Unknown ide ...         ║

Notably, the issue does not appear when an error is thrown manually from JavaScript code (e.g. throw new Error(...)), only when a host exception surfaces.

Environment Information

No response

Runtime

Native

Language

JavaScript

Example Application

No response

Version

1.0.0-beta8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglang:javascriptIssues relating to JavaScriptmodule:cliCLI module issues and features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions