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

Error when trying to access relevant call sites #71

Closed
bastiankistner opened this issue Dec 1, 2020 · 1 comment
Closed

Error when trying to access relevant call sites #71

bastiankistner opened this issue Dec 1, 2020 · 1 comment

Comments

@bastiankistner
Copy link

I am currently trying to integrate tslog in a nextjs api function. I stumbled upon an error where relevantCallSites turned out to be an array of 3 elements. Since the default for ignoreStackLevels seems to be 3, it makes sense that undefined cannot be evaluated.

I haven't yet tracked down why my callsites only have a length of 3 but in any case, it'd be better to check if relevantCallSites.length > 0 and not pass it down in case there is no CallSite left.

const stackFrame: NodeJS.CallSite = this._callSiteWrapper(
relevantCallSites[0]
);

@terehov
Copy link
Contributor

terehov commented Dec 15, 2020

Thanks for reporting and sorry that it took me so long this time.
I fixed it in 3.0.2:
https://github.com/fullstack-build/tslog/releases/tag/v3.0.2

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

Successfully merging a pull request may close this issue.

2 participants