storyblok / field-plugin

Create and deploy Storyblok Field Plugin
https://www.storyblok.com/docs/plugins/field-plugins/introduction
25 stars 3 forks source link

fix(lib): Better error message when message can not be serializable #254

Closed demetriusfeijoo closed 1 year ago

demetriusfeijoo commented 1 year ago

What?

Improve exception's message when an object is not cloneable (accepted by postMessage).

Why?

JIRA: EXT-1603

Some object structures are not allowed to be sent thru windows.postMessage() function, raising a DataCloneError exception.

However, the raised exception is not so clear to understand since this error is too generic and doesn't give so much useful information to the developer.

Exemple of a wrong message type: Screenshot 2023-08-18 at 07 40 17

Output Before: image

Output After: Screenshot 2023-08-18 at 07 38 30

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plugin-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 25, 2023 5:29pm
eunjae-lee commented 1 year ago

This PR is not refactoring the code, but it's more of an improvement on how we handle the error situation. So I renamed the title to "fix".

demetriusfeijoo commented 1 year ago

You're right @eunjae-lee .

Thanks for changing it 🎯.

demetriusfeijoo commented 1 year ago

Thanks for the detailed explanation @johannes-lindgren. 🙌

I'm going to take a look at these points.