Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide users useful feedback if the action hasn’t been accepted #1545

Closed
raullenchai opened this issue Oct 11, 2019 · 10 comments
Closed

Provide users useful feedback if the action hasn’t been accepted #1545

raullenchai opened this issue Oct 11, 2019 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@raullenchai
Copy link
Member

@koseoyoung @puncsky pls help on this one

@raullenchai raullenchai added the enhancement New feature or request label Oct 11, 2019
@zjshen14
Copy link
Contributor

#1544

@koseoyoung
Copy link
Contributor

koseoyoung commented Oct 23, 2019

I think this work is for back-end. On the other hand, for iotexscan.io(wallet) when we send transaction, the error should be shown to users since currently we are showing just the transaction hash and don't let them know the error of sendAction api. (for the ioctl, it is returning from the api, so no need to change)

@koseoyoung koseoyoung reopened this Oct 23, 2019
@koseoyoung
Copy link
Contributor

@puncsky

@koseoyoung koseoyoung assigned puncsky and unassigned koseoyoung Oct 24, 2019
@puncsky
Copy link
Contributor

puncsky commented Oct 24, 2019

@koseoyoung as long as there is some way to differentiate errors in the backend, we can throw error accordingly.

@puncsky puncsky removed their assignment Oct 24, 2019
@puncsky
Copy link
Contributor

puncsky commented Oct 24, 2019

please elaborate on the API that we can integrate with

@koseoyoung
Copy link
Contributor

koseoyoung commented Oct 24, 2019

@puncsky In SendAction api, it's returning rpc error where code is 'internal' and message contains the error msg. Just like this

&status.statusError{Code:13, Message:"reject invalid action: 89db806e64f5cee3057e55fc2ab17f773e6d60a2d958e87a13e337c1b3e9c795: error when validating transfer action: error when validating recipient's address EURYLJTDUUXSUKCJBZBXSYPJHPTGGCUPDUNTSEZTD: hrp  and address prefix io don't match: invalid index of 1", Details:[]*any.Any(nil), XXX_NoUnkeyedLiteral:struct {}{}, XXX_unrecognized:[]uint8(nil), XXX_sizecache:0}

If it is too verbose, do we need to classify and redefine the error code like this ethereum/EIPs#136 ?
And the API is
rpc SendAction(SendActionRequest) returns (SendActionResponse) {}

@puncsky
Copy link
Contributor

puncsky commented Nov 11, 2019

I think we still need error code instead of error message

@puncsky puncsky reopened this Nov 11, 2019
@yutongp
Copy link
Contributor

yutongp commented Nov 11, 2019

because
https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto
details is an any type in protobuf, basically it is an empty interface,
so we can put anything we want in details as well as define format as we like to.

@yutongp
Copy link
Contributor

yutongp commented Nov 11, 2019

for example: https://github.com/googleapis/googleapis/blob/c372c656aef153931708c80ac1a8186060841cdf/google/api/expr/v1alpha1/conformance_service.proto#L145
this IssueDetails is an error detail defined for this specific api

@koseoyoung
Copy link
Contributor

koseoyoung commented Jul 28, 2020

for example: https://github.com/googleapis/googleapis/blob/c372c656aef153931708c80ac1a8186060841cdf/google/api/expr/v1alpha1/conformance_service.proto#L145
this IssueDetails is an error detail defined for this specific api

Thanks for your helpful reference!
I tried to use google.rpc.Status as the above example, but I think I need to clone those repo to refer status.proto (unlike timestamp.proto), -- https://stackoverflow.com/questions/60878404/referencing-external-protos-like-google-rpc-status-proto

so I'm thinking about defining error code as enum, is it fine?

message SendActionResponse {
  enum ResultCode { 
    SUCCESS = 0;
    INVALID_ARGUMENT = 1;
    INVALID_BALANCE = 2;
    INSUFFICIENT_BALANCE_FOR_GAS = 3;
    INVALID_NONCE = 4;
    BLACKLISTED_ADDRESS = 5;
    INVALID_ACTPOOL = 6;
    INVALID_GAS_PRICE = 7; 
    INTERNAL_UNKNOWN = 8;
  }
  string actionHash = 1;
  ResultCode resultStatus = 2;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants