Error Handling

The SDK provides comprehensive error handling:

use onemoney_protocol::{Error, Result};

match client.get_account_nonce(address).await {
    Ok(nonce) => println!("Nonce: {}", nonce.nonce),
    Err(Error::Api { status_code: 404, .. }) => {
        println!("Account not found");
    },
    Err(Error::Http(e)) => {
        println!("Network error: {}", e);
    },
    Err(Error::Json(e)) => {
        println!("JSON parsing error: {}", e);
    },
    Err(e) => {
        println!("Other error: {}", e);
    }
}

Last updated