ensure err_msg. fix callback errors.

This commit is contained in:
Christopher Jeffrey 2014-11-11 12:05:32 -08:00
parent 82859274d6
commit c1dc858c28
1 changed files with 14 additions and 2 deletions

View File

@ -3249,6 +3249,8 @@ NAN_METHOD(WalletSendTo) {
async_wallet_sendto_data *data = new async_wallet_sendto_data();
data->err_msg = std::string("");
String::Utf8Value addr_(options->Get(NanNew<String>("address"))->ToString());
std::string addr = std::string(*addr_);
data->address = addr;
@ -3368,6 +3370,8 @@ NAN_METHOD(WalletSendFrom) {
async_wallet_sendfrom_data *data = new async_wallet_sendfrom_data();
data->err_msg = std::string("");
String::Utf8Value addr_(options->Get(NanNew<String>("address"))->ToString());
std::string addr = std::string(*addr_);
data->address = addr;
@ -4849,6 +4853,8 @@ NAN_METHOD(WalletDumpWallet) {
async_dump_wallet_data *data = new async_dump_wallet_data();
data->err_msg = std::string("");
Local<Object> options = Local<Object>::Cast(args[0]);
Local<Function> callback = Local<Function>::Cast(args[1]);
@ -4857,7 +4863,7 @@ NAN_METHOD(WalletDumpWallet) {
// Call to: EnsureWalletIsUnlocked()
if (pwalletMain->IsLocked()) {
return NanThrowError("Please enter the wallet passphrase with walletpassphrase first.");
data->err_msg = std::string("Please enter the wallet passphrase with walletpassphrase first.");
}
data->path = path;
@ -4879,6 +4885,10 @@ static void
async_dump_wallet(uv_work_t *req) {
async_dump_wallet_data* data = static_cast<async_dump_wallet_data*>(req->data);
if (data->err_msg != "") {
return;
}
std::string path = data->path;
ofstream file;
@ -4990,6 +5000,8 @@ NAN_METHOD(WalletImportWallet) {
async_import_wallet_data *data = new async_import_wallet_data();
data->err_msg = std::string("");
Local<Object> options = Local<Object>::Cast(args[0]);
Local<Function> callback = Local<Function>::Cast(args[1]);
@ -4998,7 +5010,7 @@ NAN_METHOD(WalletImportWallet) {
// Call to: EnsureWalletIsUnlocked()
if (pwalletMain->IsLocked()) {
return NanThrowError("Please enter the wallet passphrase with walletpassphrase first.");
data->err_msg = std::string("Please enter the wallet passphrase with walletpassphrase first.");
}
data->path = path;