hermeznetwork / hermez-node

Hermez node Go implementation
GNU Affero General Public License v3.0
61 stars 33 forks source link

Better error code and type when `verifyPoolL2Tx` fails #1036

Closed arnaubennassar closed 3 years ago

arnaubennassar commented 3 years ago

Rationale

The function verifyPoolL2Tx used here https://github.com/hermeznetwork/hermez-node/blob/develop/api/txspool.go#L37 internaly works with the type apiError however, the return type is error, by doing this we're returning less accurate errors in terms of error type and error code. Note that verifyPoolL2Tx internaly set the right type and code, but then we end up returning a generic error

Implementation

make verifyPoolL2Tx return the apiError