massa icon indicating copy to clipboard operation
massa copied to clipboard

Add error codes to describe operation submit or execution failure

Open peterjah opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. To facilitate application development and especially the handling of errors that can occurs when broadcasting operation to the network. It would be nice to have error codes instead of relying on error messages.

non exhaustive list of errors i would like to have:

INVALID_MAX_GAS NOT_ENOUGH_GAS INVALID_COINS_AMOUNT INVALID_DATASTORE NOT_ENOUGH_COINS SC_RUNTIME_ERROR OPERATION_EXPIRED (bonus !)

Describe the solution you'd like Ideally the error code (if any) would be returned by the get_operations endpoint. This would avoid to fetch events in case of error to find out what happened additionnaly errors code should also be returned when invalid operation is submited in

  • send_operation
  • execute_readonly_call
  • execute_readonly_bytecode
  • executeReadOnlyResponse

peterjah avatar Nov 23 '23 17:11 peterjah

Those error codes could also be prepended to existing error messages that are send back to the user by generate_event(). something like [error_code: int][error_message: str]

bilboquet avatar Nov 23 '23 17:11 bilboquet