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

fix(cli): return non-ABI error responses #582

Merged
merged 2 commits into from
Dec 16, 2024
Merged

Conversation

merklefruit
Copy link
Collaborator

Fixes the weird error response:

Error: type check failed for "BoltValidatorsErrors" with data: 

Caused by:
    type check failed for "BoltValidatorsErrors" with data: 

Location:
    src/commands/validators.rs:83:39

when receiving a response from the RPC that's not necessarily an ABI-decodable error (for instance, "insufficient funds")

@@ -69,12 +69,19 @@ pub fn write_to_file<T: Serialize>(out: &str, data: &T) -> Result<()> {
pub fn try_parse_contract_error<T: SolInterface>(error: ContractError) -> Result<T, ContractError> {
match error {
ContractError::TransportError(TransportError::ErrorResp(resp)) => {
let data = resp.data.unwrap_or_default();
let data = resp.data.clone().unwrap_or_default();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this clone?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the last commit

@mempirate mempirate merged commit 556eb1f into unstable Dec 16, 2024
3 checks passed
@mempirate mempirate deleted the fix/cli/parse-errors branch December 16, 2024 18:13
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.

4 participants