MetaMask / snaps

Extend the functionality of MetaMask using Snaps

Home Page:https://metamask.io/snaps/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve superstruct error messaging in `snaps-rpc-methods`

hmalik88 opened this issue · comments

This mostly involves work around deeply nested struct definitions i.e. unions of unions. We need a way to reliably throw the correct error and perhaps give a diff of thrown errors all at once.

For example: Invalid params: At path: ui -- Expected the value to satisfy a union of object | object | object | object | object | object | object | object | object | object | object | object, but received: [object Object].

For example: Invalid params: At path: ui -- Expected the value to satisfy a union of object | object | object | object | object | object | object | object | object | object | object | object, but received: [object Object].

Ah yeah if this is one of the custom ui rpc methods, I think we're using create here to validate params which throws on this first beautiful error 😄