gottstech / gotts

A blockchain for non-collateralized stable-coins, follow MimbleWimble protocol but with explicit amount.
https://gotts.tech
Apache License 2.0
48 stars 4 forks source link

Refact: detail the display of keychain errors #26

Closed garyyu closed 4 years ago

garyyu commented 4 years ago

In case of the Keychain error or Transaction error, we only see the error string as some kind of keychain error, which looks like the un-finished job before.

Two main changes in this PR:

  1. Keychain error and Transaction error use Fail string for each enum.
  2. Give an error log and detailed error info on the post pool API, which will be useful for wallet:
    let res = tx_pool.add_to_pool(source, tx, !fluff, &header);
    let err_str = if let Err(e) = &res {
        error!("Pushing transaction {} to pool failed: e = {}", tx_hash, e);    <<<< Error Log
        format!("Failed to update pool with e = {}", e)     <<<< Post API  Response Body
    } else {
        String::new()
    };
    res.context(ErrorKind::Internal(err_str))?;