dymensionxyz / dymint

Sequencing Engine for Dymension RollApps
Other
90 stars 61 forks source link

fix(code standards): use dymensionxyz/gerrc instead of gerr #925

Closed danwt closed 1 week ago

danwt commented 1 week ago

PR Standards

This will unify our errors across all repos see also https://github.com/dymensionxyz/dymension/pull/959

Opening a pull request should be able to meet the following requirements

--

PR naming convention: https://hackmd.io/@nZpxHZ0CT7O5ngTp0TP9mg/HJP_jrm7A


Closes https://github.com/dymensionxyz/dymint/issues/924

<-- Briefly describe the content of this pull request -->

For Author:


For Reviewer:


After reviewer approval:

mtsitrin commented 1 week ago

importing the gerr pacakge in dymint, does running this snippet make sense?

// use this function only during a program startup phase.
func registerAndWrap(code uint32, err error) Error {
    var gErr gerr.Error
    if !errors.As(err, &gErr) {
        panic("errs as gerr")
    }
    sdkerr := errorsmod.RegisterWithGRPCCode(DefaultCodespace, code, gErr.GrpcCode(), err.Error())
    return Error{sdkerr}
}