osmosis-frontend icon indicating copy to clipboard operation
osmosis-frontend copied to clipboard

refactor: clean up chain error message handling

Open p0mvn opened this issue 1 year ago • 0 comments

Context

To format chain error message, we do regex parsing: https://github.com/osmosis-labs/osmosis-frontend/blob/a2d830e9b466e720a5a75fe9f620b9ca31a048c1/packages/web/components/alert/prettify.ts#L6-L19

A cleaner approach would be to check SDK error codes like we do here: https://github.com/osmosis-labs/osmosis-frontend/blob/a2d830e9b466e720a5a75fe9f620b9ca31a048c1/packages/web/components/alert/tx-event-toast.ts#L79-L81

An example of an error code: https://github.com/cosmos/cosmos-sdk/blob/8f6a94cd1f9f1c6bf1ad83a751da86270db92e02/types/errors/errors.go#L129

We should refactor our error handling and formatting to be dependent on error codes as opposed to regex matching

Acceptance Criteria

  • Cleaned up errors
  • Error codes used
  • All tested
  • No error message is broken by the refactor

p0mvn avatar Jan 31 '24 02:01 p0mvn