cosmwasm: Split FfiError::Other

FfiError::Otherdoes too many things right now. I suggest the following split

  • FfiError::InvalidUtf8 when the Go backend returned something that cannot be converted to String (backend’s fault)
  • FfiError::InputError when the API complains about invalid input (i.e. not the backend’s fault). Can potentially be back to the contract, depending in the import.
  • FfiError::Unknown { msg: Option<String> } for whatever is left

@reuvenpo thoughts?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

So – this brings us back to

pub enum FfiError {
    // ...

    // This is the only error case of FfiError that is reported back to the contract.
    InputError {
        // This is processed as part of if the import implementation before sending the response to the contract
        gas_info: GasInfo,
        // a human readable error message sent back to the contract
        msg: String,
    }

    // ...
}

, right?

As i said in the #443 comment, i think this naming scheme is OK for now, but the ApiError name is more general, so feel free to use it instead if you think it’s better.