Skip to content

Commit d64bc6c

Browse files
committed
Report an error when request for accounts fails
Also make sure the private key pem doesn't escape new lines
1 parent f0a1d1a commit d64bc6c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/coinbase_exchange.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ impl ExchangeClient for CoinbaseExchangeClient {
2121
pin_mut!(accounts);
2222

2323
while let Some(account_result) = accounts.next().await {
24+
if let Err(e) = account_result {
25+
return Err(format!("Failed to get accounts: {e}").into());
26+
}
2427
for account in account_result.unwrap() {
2528
if let Ok(id) = coinbase_rs::Uuid::from_str(&account.id) {
2629
if token.name() == account.currency.code
@@ -157,6 +160,7 @@ pub fn new(
157160
}: ExchangeCredentials,
158161
) -> Result<CoinbaseExchangeClient, Box<dyn std::error::Error>> {
159162
assert!(subaccount.is_none());
163+
let secret = secret.replace("\\n", "\n");
160164
Ok(CoinbaseExchangeClient {
161165
client: coinbase_rs::Private::new(coinbase_rs::MAIN_URL, &api_key, &secret),
162166
})

0 commit comments

Comments
 (0)