potential error handling.

This commit is contained in:
Christopher Jeffrey 2014-12-01 15:12:01 -08:00
parent 9182f5b3b2
commit 7e00980db2
1 changed files with 7 additions and 6 deletions

View File

@ -464,7 +464,7 @@ typedef struct _ctx_list {
CTransaction ctx; CTransaction ctx;
uint256 blockhash; uint256 blockhash;
struct _ctx_list *next; struct _ctx_list *next;
std::string err; std::string err_msg;
} ctx_list; } ctx_list;
struct async_addrtx_data { struct async_addrtx_data {
@ -2062,8 +2062,8 @@ done:
return; return;
#else #else
ctx_list *ctxs = read_addr(data->addr); ctx_list *ctxs = read_addr(data->addr);
if (!ctxs->err.empty()) { if (!ctxs->err_msg.empty()) {
data->err_msg = ctxs->err; data->err_msg = ctxs->err_msg;
return; return;
} }
data->ctxs = ctxs; data->ctxs = ctxs;
@ -5875,7 +5875,7 @@ read_addr(const std::string addr) {
ctx_list *head = new ctx_list(); ctx_list *head = new ctx_list();
ctx_list *cur = NULL; ctx_list *cur = NULL;
head->err = std::string(""); head->err_msg = std::string("");
CScript expectedScriptSig = GetScriptForDestination(CBitcoinAddress(addr).Get()); CScript expectedScriptSig = GetScriptForDestination(CBitcoinAddress(addr).Get());
@ -5951,10 +5951,11 @@ read_addr(const std::string addr) {
found: found:
pcursor->Next(); pcursor->Next();
} catch (std::exception &e) { } catch (std::exception &e) {
throw error("%s : Deserialize or I/O error - %s", __func__, e.what()); // throw runtime_error(e.what() + std::string(" : Deserialize or I/O error - %s"));
// head->err = std::string("LevelDB Error"); // head->err_msg = std::string(e.what() + std::string(" : Deserialize or I/O error - %s"));
// delete pcursor; // delete pcursor;
// return head; // return head;
;
} }
} }