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

Make sure we leave objects in good standing if there is an error #52

Merged
merged 1 commit into from
Jul 9, 2021

Conversation

mcollina
Copy link
Collaborator

@mcollina mcollina commented Jul 9, 2021

No description provided.

@mcollina mcollina merged commit a255cd1 into master Jul 9, 2021
@mcollina mcollina deleted the fix-complex-proxy-case branch July 9, 2021 12:37
@thetutlage
Copy link

thetutlage commented Jul 19, 2021

After this release, the behavior for the following code has changed. It this is the expected outcome or a regression?

const safeStringify = require('fast-safe-stringify')

try {
  console.log(safeStringify({
    toJSON() {
      throw new Error('blowup')
    },
  }))
} catch (error) {
  console.log('never reached here')
  console.log(error)
}

With v2.0.7, the catch block was executed and now the code never reaches the catch block and returns a string saying "[unable to serialize, circular reference is too complex to analyze]"

Reproduction repo: https://github.com/thetutlage/fast-safe-stringify-reproduction

@mcollina
Copy link
Collaborator Author

That's expected!

thetutlage added a commit to poppinss/utils that referenced this pull request Jul 19, 2021
A recent PR davidmarkclements/fast-safe-stringify#52 in
fast-safe-stringify changes the behavior from what we need and hence we just
take the required code and write it inline
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 this pull request may close these issues.

3 participants