Skip to content

Unnecessary error in extractSource due to not checking for null #2744

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
erights opened this issue Apr 27, 2021 · 4 comments
Closed

Unnecessary error in extractSource due to not checking for null #2744

erights opened this issue Apr 27, 2021 · 4 comments
Assignees
Labels
bug current functionality does not work as desired help wanted
Milestone

Comments

@erights
Copy link
Contributor

erights commented Apr 27, 2021

The line at

if (callSite.file === normalizedFile) {

should be changed to

if (callsite && callSite.file === normalizedFile) {

since the previous line

const callSite = stackUtils.parseLine(line);

may, and sometimes does, initialize callSite to null. Once this is fixed, if the catch at

} catch {}

was there only because of this one error, then this do-nothing catch should be removed.

@novemberborn
Copy link
Member

Thanks, that makes sense. I'll try and get this into the next release if nobody else beats me to it.

Looking at the commit history, the earlier logic checked for a falsy value so I assume the catch isn't needed with this guard.

@novemberborn novemberborn added bug current functionality does not work as desired help wanted labels May 3, 2021
@novemberborn novemberborn added this to the 4.0 milestone May 3, 2021
@Fem-Fem
Copy link
Contributor

Fem-Fem commented May 6, 2021

Hi! Would it be possible for me to work on this?

@novemberborn
Copy link
Member

@Fem-Fem that'd be great!

@Fem-Fem
Copy link
Contributor

Fem-Fem commented May 7, 2021

Thanks! I have a PR here: #2750

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired help wanted
Projects
None yet
Development

No branches or pull requests

3 participants