Skip to content

Fix #45 and making it possible to only import the parse method #65

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

Closed
wants to merge 1 commit into from

Conversation

Jikstra
Copy link

@Jikstra Jikstra commented Aug 13, 2021

As it's possible to partially import the parse method from errorStackParser, the this invokation will be wrong as currently the parent object is not explicetly bound to the parse method (and all other methods). So something like this fails:

import { parse } from 'error-stack-parser'
...

const frames = errorStackParser.parse(error);

with following error: TypeError: Cannot read property 'parseV8OrIE' of undefined

Description

I created an errorStackParser object, added .bind(errorStackParser) to all methods and returned this obj.

Motivation and Context

See description

#45

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • node_modules/.bin/jscs -c .jscsrc error-stack-parser.js passes without errors
    • jscs isnt working for me, but also not in the dependencies? Is this still up to date?
  • npm test passes without errors
  • I have read the contribution guidelines
    • this file doesnt exist or i didnt find it
  • I have updated the documentation accordingly
    • nothing changed
  • I have added tests to cover my changes
    • i could add a simple test, but it needs to run in another sandbox as the browser sandbox doesnt have access to require/import

@Jikstra Jikstra force-pushed the fix_partial_import branch from 574293d to ac09693 Compare August 13, 2021 13:39
@niftylettuce
Copy link
Contributor

If this is still an issue, can you resolve the conflict and ping me back once done?

@eriwen
Copy link
Member

eriwen commented Jun 5, 2022

I have merged and made changes in 1588ff9#diff-4cca18169d8ca3240eb941bdc4b36cfc0c492cbfdca198862f85db32c986c468 to prevent partial import.

Please use this way starting with version 2.1.0 which I just published:

const ErrorStackParser = require('error-stack-parser');
// other code
const frames = ErrorStackParser.parse(err);

@eriwen eriwen closed this Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants