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

Improved error propagation for fallible validator api queries #1681

Merged

Conversation

jstuczyn
Copy link
Contributor

@jstuczyn jstuczyn commented Oct 12, 2022

Description

Closes: #1957

The change is best represented with the following code snippet:

let client = ApiClient::new("https://qa-validator-api.nymtech.net/api/".parse().unwrap());
let mix_id_that_doesnt_exist = 123456;
let res = client
    .get_mixnode_stake_saturation(mix_id_that_doesnt_exist)
    .await;
println!("{:?}", res)

// old: Err(ValidatorAPIError { source: ReqwestClientError { source: reqwest::Error { kind: Decode, source: Error("expected value", line: 1, column: 1) } } })
// new: Err(ValidatorAPIError { source: ApiRequestFailure { status: 404, error: RequestError { message: "mixnode bond not found" } } })

Note: it requires both, validator-api redeployment and local client updates

Checklist:

  • added a changelog entry to CHANGELOG.md

@jstuczyn jstuczyn force-pushed the feature/improve-validator-api-failures-deserialisation branch from 0bc293c to 346b4b0 Compare October 18, 2022 08:18
@jstuczyn jstuczyn changed the base branch from develop to release/v1.1.0 October 31, 2022 14:50
@jstuczyn jstuczyn force-pushed the feature/improve-validator-api-failures-deserialisation branch from 346b4b0 to 559f434 Compare October 31, 2022 14:54
@jstuczyn jstuczyn merged commit 3727370 into release/v1.1.0 Oct 31, 2022
@jstuczyn jstuczyn deleted the feature/improve-validator-api-failures-deserialisation branch October 31, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix deserialization return types in the validator-api client.
1 participant