flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

[EVM] Add the `GetErrorForCode` helper method

Open m-Peter opened this issue 1 year ago • 3 comments

This method performs is the inverse mapping of ExecutionErrorCode and ValidationErrorCode. It returns the corresponding error object, given an ErrorCode value.

m-Peter avatar May 14 '24 09:05 m-Peter

What is the use case for this?

janezpodhostnik avatar May 16 '24 06:05 janezpodhostnik

Codecov Report

Attention: Patch coverage is 0% with 67 lines in your changes missing coverage. Please review.

Project coverage is 55.90%. Comparing base (7029607) to head (c3b788e). Report is 32 commits behind head on master.

Files Patch % Lines
fvm/evm/types/codeFinder.go 0.00% 67 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5907      +/-   ##
==========================================
+ Coverage   55.88%   55.90%   +0.01%     
==========================================
  Files        1131     1123       -8     
  Lines       89497    89195     -302     
==========================================
- Hits        50015    49861     -154     
+ Misses      34719    34579     -140     
+ Partials     4763     4755       -8     
Flag Coverage Δ
unittests 55.90% <0.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 16 '24 06:05 codecov-commenter

@janezpodhostnik This method is currently defined in the Flow EVM Gateway. But other community members have needed this functionality, so I thought of making it available from the flow-go repository. We have methods ExecutionErrorCode & ValidationErrorCode, which given an error argument, they return the necessary ErrorCode. But until now, we didn't have the inverse functionality to get the error given an ErrorCode argument.

m-Peter avatar May 16 '24 07:05 m-Peter