[FIX] Catch jsonRPC exceptions

Fixes #1339 once merged.
This commit is contained in:
Sebastian Grewe 2014-01-10 16:20:24 +01:00
parent 2ae3357b23
commit 627b7a17ff
4 changed files with 7 additions and 7 deletions

View File

@ -61,13 +61,13 @@ if ($setting->getValue('disable_manual_payouts') != 1) {
$log->logError('Failed to verify this users coin address, skipping payout');
continue;
}
} catch (BitcoinClientException $e) {
} catch (Exception $e) {
$log->logError('Failed to verify this users coin address, skipping payout');
continue;
}
try {
$txid = $bitcoin->sendtoaddress($aData['coin_address'], $dBalance - $config['txfee']);
} catch (BitcoinClientException $e) {
} catch (Exception $e) {
$log->logError('Failed to send requested balance to coin address, please check payout process. Does the wallet cover the amount?');
continue;
}
@ -123,7 +123,7 @@ if ($setting->getValue('disable_auto_payouts') != 1) {
$log->logError('Failed to verify this users coin address, skipping payout');
continue;
}
} catch (BitcoinClientException $e) {
} catch (Exception $e) {
$log->logError('Failed to verify this users coin address, skipping payout');
continue;
}
@ -131,7 +131,7 @@ if ($setting->getValue('disable_auto_payouts') != 1) {
// Send balance, fees are reduced later by RPC Server
try {
$txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee']);
} catch (BitcoinClientException $e) {
} catch (Exception $e) {
$log->logError('Failed to send requested balance to coin address, please check payout process. Does the wallet cover the amount?');
continue;
}

View File

@ -313,7 +313,7 @@ class BitcoinClient extends jsonRPCClient {
public function can_connect() {
try {
$r = $this->getinfo();
} catch (BitcoinClientException $e) {
} catch (Exception $e) {
return $e->getMessage();
}
return true;

View File

@ -332,7 +332,7 @@ class User extends Base {
$this->setErrorMessage('Invalid coin address');
return false;
}
} catch (BitcoinClientException $e) {
} catch (Exception $e) {
$this->setErrorMessage('Unable to verify coin address');
return false;
}

View File

@ -129,7 +129,7 @@ class jsonRPCClient {
'content' => $request
));
$context = stream_context_create($opts);
if ($fp = fopen($this->url, 'r', false, $context)) {
if ($fp = @fopen($this->url, 'r', false, $context)) {
$response = '';
while($row = fgets($fp)) {
$response.= trim($row)."\n";