GitShow/sindresorhus/serialize-error
sindresorhus

serialize-error

Serialize/deserialize an error into a plain object

by sindresorhus
Star on GitHubForknpm

JavaScript

599 stars68 forks22 contributorsQuiet · 5mo agoSince 2015v13.0.1MIT

Meet the team

See all 22 on GitHub →
sindresorhus
sindresorhus57 contributions
fregante
fregante17 contributions
BendingBender
BendingBender2 contributions
Weakky
Weakky2 contributions
rj-david
rj-david1 contribution
misozask
misozask1 contribution
jackple
jackple1 contribution
hec10r
hec10r1 contribution

Languages

View on GitHub →
JavaScript96%
TypeScript4%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Quiet · 3 discussions · Last activity 5mo ago
See all on GitHub →
fregante
Optionally preserve current stackOpenIssue

An issue I found when throwing deserialized errors is that the thrown error has no reference to this point. I think the "correct" way to throw serialized errors would be something like: Two drawbacks: doesn't benefit from https://github.com/sindresorhus/serialize-error/pull/70 this isn't necessarily what people want or expect by default So how about:

fregante · 8mo ago

Recent fixes

View closed PRs →
punkpeye
Performance bottleneck in destroyCircular implementationClosedIssue

I've been profiling my application and noticed that has become a bit of a bottleneck in hot paths where errors are serialized frequently. I identified several inefficiencies in the function. Current Issues 1. O(n²) memory from copying array on each recursion For deeply nested objects, this creates significant memory pressure and GC overhead. 2. Linear search for circular reference detection is O(n), which compounds poorly with deep/wide object graphs. 3. Unnecessary intermediate array allocation allocates a new array of tuples on every call. Proposed Fixes Use a Set with backtracking instead of copied arrays This changes: O(n²) memory → O(n) O(n) circular checks → O(1) Replace Object.entries with for...in

punkpeye · 5mo ago
TimStepanovAtBrandBoosting
Release a new version to NPM to make the constructor factory feature available.ClosedIssue

While I am unsure that this is the best place to mention this, I ran into the following issue: I saw that there is a way to define a factory function to register complex error constructors. However, I then had to realize that this feature is not yet available in the npm release of this package. The last released version is over a year old at this point. Would it be possible to release a new version to NPM? I know I could just use the package from GitHub directly, but I do not like doing that in production apps.

TimStepanovAtBrandBoosting · 5mo ago
sindresorhus
Add factory function support for incompatible error constructorsMergedPR

Fixes #72

sindresorhus · 8mo ago
Structured data for AI agents

Repository: sindresorhus/serialize-error. Description: Serialize/deserialize an error into a plain object Stars: 599, Forks: 68. Primary language: JavaScript. Languages: JavaScript (96%), TypeScript (4%). License: MIT. Latest release: v13.0.1 (5mo ago). Open PRs: 0, open issues: 3. Last activity: 5mo ago. Community health: 85%. Top contributors: sindresorhus, fregante, BendingBender, Weakky, rj-david, misozask, jackple, hec10r, braco, vladimiry and others.

·@ofershap

Replace github.com with gitshow.dev