flightcontrolhq / superjson

Safely serialize JavaScript expressions to a superset of JSON, which includes Dates, BigInts, and more.
https://www.flightcontrol.dev?ref=superjson
MIT License
4.13k stars 91 forks source link

Makes sure custom errors are also serialized properly #149

Closed ntgussoni closed 3 years ago

ntgussoni commented 3 years ago

This PR makes sure that custom errors get serialized properly.

I have a custom error extending AuthorizationError in blitz and it wasn't being serialized. This change checks if the prototype is an instanceof Error as well

ntgussoni commented 3 years ago

I might've been too tired when checking this. Just double checked and my change fixes nothing because nothing seems to be broken on the first place.

I'm closing this and I'll do some further investigation on my side