comlink icon indicating copy to clipboard operation
comlink copied to clipboard

Unserializable return type error

Open EliteScientist opened this issue 3 years ago • 5 comments
trafficstars

When an unserializable type is returned such as a function, this results in an uncaught error. In Deno, this crashes the application. This change catches the error and returns a serialized error type so that it can be handled by the calling thread.

According to the MDN, there are currently two types of objects that do not work with the structured clone algorithm and will result in a DataCloneError: "a function" and "a DOM node".

EliteScientist avatar Dec 08 '21 00:12 EliteScientist

Please re-scan.

EliteScientist avatar Dec 08 '21 00:12 EliteScientist

Do you mind adding a test for this as well?

surma avatar Dec 08 '21 10:12 surma

@surma Sure, I added it at the end of "same_window.comlink.test.js".

EliteScientist avatar Dec 08 '21 21:12 EliteScientist

@surma Good evening sir, just checking the status on this PR. is there anything else that you need from me before merging? thanks.

EliteScientist avatar Jan 20 '22 04:01 EliteScientist

+1. I'm having the same issue.

jcriquet avatar Jan 29 '22 02:01 jcriquet

This looks great, if you wouldn't mind running npm run fmt on the PR to get the formatting fixed I'd be happy to merge for the next version.

benjamind avatar Jan 24 '23 22:01 benjamind

This looks great, if you wouldn't mind running npm run fmt on the PR to get the formatting fixed I'd be happy to merge for the next version.

Awesome. Will do as soon as I get to my computer later today.

EliteScientist avatar Jan 26 '23 18:01 EliteScientist

@benjamind I have rebased the main branch on my fork and have also ran npm run fmt. :)

EliteScientist avatar Jan 26 '23 22:01 EliteScientist

Thanks!

benjamind avatar Jan 26 '23 22:01 benjamind

Thanks!

Anytime!

EliteScientist avatar Jan 26 '23 22:01 EliteScientist