Skip to content

The output is not JSON.stringify-safe #55

Description

@tjconcept
import {serializeError} from 'serialize-error'

const err = new Error
err.timestamp = process.hrtime.bigint()

JSON.stringify(serializeError(err))

// Uncaught TypeError: Do not know how to serialize a BigInt
//     at JSON.stringify (<anonymous>)

The fix seems simple if doing something akin to buffers (though the value could be embedded). Am I missing something? If fixed by a PR, could it be backported no a non-ESM version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions