gnolang / gnonative

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

feat: Use the Buf's ConnectError to throw errors to React-Native #68

Closed D4ryl00 closed 8 months ago

D4ryl00 commented 8 months ago

The ConnectError object has a Details field that allows us to add our API error type next to the GRPC error (see doc).

In Go, before returning an API's type error, we have to encapsulate it in the ConnectError object, with the .grpc() method. To handle the error correctly in React-Native, I added a GRPCError class. We can get the API's error code with the .errCode() method.