GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Parsing a stack trace in Node.js throws an exception · Issue #45 · stacktracejs/error-stack-parser

Parsing a stack trace in Node.js throws an exception #45

New issue
Copy link
New issue
Copy link
Closed
Closed
Parsing a stack trace in Node.js throws an exception#45
Copy link
Labels
a:bug

Description

@ashleydavis
ashleydavis
opened on Jan 16, 2019
Issue body actions

Hi thanks for this library. It looks great all though I've had some problems getting off the starting block with it.

I've prepared an example project which I believe should work but while parsing a stack trace from an exception it throws an error.

Expected Behavior

No exception should be thrown while parsing the stack trace in the example project.

Current Behavior

The following exception is thrown while parsing the stack trace in the example project:

C:\projects\github\stack-trace-test\node_modules\error-stack-parser\error-stack-parser.js:31                                      
                return this.parseV8OrIE(error);                                                                                   
                            ^                                                                                                     
                                                                                                                                  
TypeError: Cannot read property 'parseV8OrIE' of undefined                                                                        
    at ErrorStackParser$$parse (C:\projects\github\stack-trace-test\node_modules\error-stack-parser\error-stack-parser.js:31:29)  
    at Object.<anonymous> (C:\projects\github\stack-trace-test\my test script.js:18:20)                                           
    at Module._compile (module.js:643:30)                                                                                         
    at Object.Module._extensions..js (module.js:654:10)                                                                           
    at Module.load (module.js:556:32)                                                                                             
    at tryModuleLoad (module.js:499:12)                                                                                           
    at Function.Module._load (module.js:491:3)                                                                                    
    at Function.Module.runMain (module.js:684:10)                                                                                 
    at startup (bootstrap_node.js:187:16)                                                                                         
    at bootstrap_node.js:608:3                                                                                                    

Steps to Reproduce (for bugs)

I've prepared an example repository:
https://github.com/ashleydavis/stack-trace-test

Clone the repo. Or download and unpack the repo.
Use npm install to install dependencies.
Use npm start to run the example project.

The exception mentioned above is thrown.

Context

I was hoping to use your stack trace parser in my project, but I've been blocked from using it by some basic problems. This is just the first issue, if we can solve this one I'll prepare an example that demonstrates the next problem.

Your Environment

  • stacktrace.js version: 2.0.2
  • Browser Name and version: Node.js v8.9.4
  • Operating System and version (desktop or mobile): Windows 10
  • Link to your project: https://github.com/ashleydavis/stack-trace-test

Possible Solution

Sorry, no idea.

Activity

  1. ashleydavis
    changed the title [-]Parsing a stack trace in Node.js throwns an exception[/-] [+]Parsing a stack trace in Node.js throws an exception[/+] on Jan 16, 2019
  2. ashleydavis commented on Jan 16, 2019

    @ashleydavis
    ashleydavis
    on Jan 16, 2019
    Author
    More actions

    I have a work around to this problem.

    Code like this doesn't work:

    const { parse } = require('error-stack-parser');
    
    ...
    
    const frames = parse(error);
    
    

    This code does work:

    const errorStackParser = require('error-stack-parser');
    
    ...
    
    const frames = errorStackParser.parse(error);
    

    This is no longer a crucial problem for me, but would be nice if it would work because that's a common coding idiom in JavaScript.

  3. eriwen
    added
    a:bug
    on Jan 5, 2020
  4. Jikstra commented on Aug 13, 2021

    @Jikstra
    Jikstra
    on Aug 13, 2021
    More actions

    What also works is following:

    import errorStackParser from 'error-stack-parser'
    
    const frames = errorStackParser.parse(error);
    

    I think the problem is that if one invokes parse without the outer scope/object, this will be undefined in https://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js#L27

  5. Jikstra
    added 2 commits that reference this issue on Aug 13, 2021

    Fix stacktracejs#45 and making it possible to only import the parse m…

    This issue will close once commit 574293d is merged into the 'master' branch.
    574293d

    Fix stacktracejs#45 and making it possible to only import the parse m…

    This issue will close once commit ac09693 is merged into the 'master' branch.
    ac09693
  6. eriwen commented on Jun 5, 2022

    @eriwen
    eriwen
    on Jun 5, 2022
    Member
    More actions

    I merged #74 to address this and published v2.1.0

  7. eriwen
    closed this as completedon Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.