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

document that parseLine can return null #41

Open
travellingprog opened this issue Jul 9, 2019 · 1 comment
Open

document that parseLine can return null #41

travellingprog opened this issue Jul 9, 2019 · 1 comment

Comments

@travellingprog
Copy link

For some reason, at the top of the stack of one particular error, I have only the error message, rather than a line with a filename. Therefore, my code ran into an issue because it called stack.parseLine(firstLineOfStack) and assumed this method would return an object. I did not realize that this method could return null. I assumed that if it could not parse a line, it would return an object where the properties are set to empty values, or perhaps throw an error.

I believe this possibility should be documented.

But thanks for the great library!

@conartist6
Copy link

conartist6 commented Nov 1, 2021

This is fixed in stack-tools, which throws an error if a stack frame cannot be parsed. It can also do this more safely because unparseable stack frames are likely to be messages from nested errors, for example those produced by nested-error-stacks. stack-tools offers first class support for this, for example by allowing you to write this:

cleanErrors(parseErrors(error), frame => shouldRemoveFrame(frame));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants