Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix ^ in stack trace with vm's columnOffset #15771

Closed
wants to merge 1 commit into from

Commits on Oct 4, 2017

  1. src: fix ^ in stack trace with vm's columnOffset

    While VM module's columnOffset option does succeed in applying an offset
    to the column number in the stack trace, the wavy diagram printed does
    not account for potential offsets, resulting in erroneous location of
    `^` in the first line of the script.
    
    Before:
    
    ```
    > vm.runInThisContext('throw new Error()', { columnOffset: 5 })
    evalmachine.<anonymous>:1
    throw new Error()
         ^
    
    Error
        at evalmachine.<anonymous>:1:12
        at ContextifyScript.Script.runInThisContext (vm.js:44:33)
        at Object.runInThisContext (vm.js:116:38)
    ```
    
    After:
    
    ```
    > vm.runInThisContext('throw new Error()', { columnOffset: 5 })
    evalmachine.<anonymous>:1
    throw new Error()
    ^
    
    Error
        at evalmachine.<anonymous>:1:12
        at ContextifyScript.Script.runInThisContext (vm.js:50:33)
        at Object.runInThisContext (vm.js:139:38)
        at repl:1:4
    ```
    TimothyGu committed Oct 4, 2017
    Configuration menu
    Copy the full SHA
    d11a86a View commit details
    Browse the repository at this point in the history