Skip to content

Commit 7d09804

Browse files
authored
Merge pull request #52 from telosnetwork/get_table_rows_error_message
Include more details in the error message returned by some APIs
2 parents d701cd9 + 44ccd4f commit 7d09804

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/antelope/src/api/v1/chain.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ impl<T: Provider> ChainAPI<T> {
151151
let message = format!("Failed to parse JSON: {}", e);
152152
ClientError::encoding(message)
153153
}),
154-
Err(_) => Err(ClientError::encoding("Request failed".into())),
154+
Err(error) => Err(ClientError::encoding(format!(
155+
"Request failed, reason: {}",
156+
error
157+
))),
155158
}
156159
}
157160

@@ -297,7 +300,12 @@ impl<T: Provider> ChainAPI<T> {
297300

298301
let response = match result.await {
299302
Ok(response) => response,
300-
Err(_) => return Err(ClientError::NETWORK("Failed to get table rows".into())),
303+
Err(error) => {
304+
return Err(ClientError::NETWORK(format!(
305+
"Failed to get table rows, reason: {}",
306+
error
307+
)))
308+
}
301309
};
302310
let json: Value = serde_json::from_str(response.as_str()).unwrap();
303311
let response_obj = JSONObject::new(json);

0 commit comments

Comments
 (0)