Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Prevent throwing TypeError: Converting circular structure #69

Open
StephanGeorg opened this issue Oct 16, 2019 · 0 comments
Open

Prevent throwing TypeError: Converting circular structure #69

StephanGeorg opened this issue Oct 16, 2019 · 0 comments

Comments

@StephanGeorg
Copy link

StephanGeorg commented Oct 16, 2019

JSON.stringify throws by default "TypeError: Converting circular structure to JSON" in @timberio/node when trying to log context like

const context = {};
context.c = context;

Should handle gracefully with https://github.com/davidmarkclements/fast-safe-stringify to prevent from just throwing by following the protip.

I had this issue by logging an unknown object from a module. Thought it could be an improvement when the library itself is doing such conversion.

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

No branches or pull requests

1 participant