gnolang / gnonative

Develop for Gno using your app's native language
Apache License 2.0
9 stars 9 forks source link

Error structure format #117

Open iuricmp opened 4 months ago

iuricmp commented 4 months ago

As a developer, I'd like a better Error structure from the GnoNative library.

For example, when I have to deal with an Error (eg: ErrUnknownAddress) thrown by GnoNative and I have to convert it to JSON, I get:

{"name": "ConnectError", "rawMessage": "ErrUnknownAddress(#206)", "code":2, "metadata":{"map":{}}, "details":[]}

It would be great if we had a better structure, eg:

{
  "type": "ErrUnknownAddress",
  "code": "206",
  "message": "The address provided is unknown on the blockchain.",
  "documentation_url" : "[https://gno.land/api/docs/errors/ERR-206](https://gno.land/api/docs/errors/ERR-206)"
 }
jefft0 commented 4 months ago

There is already a JavaScript error data structure. @D4ryl00 and @iuricmp to coordinate to try it.

jefft0 commented 3 months ago

Wait for the PR for MsgCall to return JSON results and see if the panic response also has helpful JSON.