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

Handle QueryErrors in client #2105

Closed
0x009922 opened this issue Apr 15, 2022 · 1 comment · Fixed by #2160
Closed

Handle QueryErrors in client #2105

0x009922 opened this issue Apr 15, 2022 · 1 comment · Fixed by #2160
Assignees
Labels
Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST

Comments

@0x009922
Copy link
Contributor

0x009922 commented Apr 15, 2022

The Problem

If you go to api_spec.md#query, you may found the following table:

Responses:

Response Status Body *
Decode err. 400 QueryError::Decode(Box<iroha_version::error::Error>)
Version err. 400 QueryError::Version(UnsupportedVersionError)
Signature err. 401 QueryError::Signature(String)
Permission err. 403 QueryError::Permission(String)
Evaluate err. 400 QueryError::Evaluate(String)
Find err. 404 QueryError::Find(Box<FindError>)
Conversion err. 400 QueryError::Conversion(String)
Success 200 VersionedQueryResult

Currently, iroha_client does handle only 200 response, and just throws an untyped error in case when status code is not 200.

The Request

Handle 400-404 status codes too and return result with QueryError when it is possible:

enum RequestError {
  BadRequest(QueryError),
  Undefined(Whatever)
}

fn request(/* ... */) -> Result<R::Output, RequestError> {}
@0x009922 0x009922 added Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST labels Apr 15, 2022
@s8sato s8sato self-assigned this Apr 15, 2022
@s8sato
Copy link
Contributor

s8sato commented Apr 20, 2022

@0x009922 0x009922 self-assigned this Apr 28, 2022
0x009922 added a commit to 0x009922/iroha that referenced this issue Apr 28, 2022
@0x009922 0x009922 linked a pull request Apr 28, 2022 that will close this issue
appetrosyan pushed a commit that referenced this issue May 6, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
appetrosyan pushed a commit to appetrosyan/iroha that referenced this issue May 12, 2022
mversic pushed a commit to mversic/iroha that referenced this issue May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants