diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-03-06 05:23:33 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-03-06 05:23:33 +0000 |
commit | eb9aae6f5f498c70d4879249dcd5537899b7661c (patch) | |
tree | ed2b23adb0e1e44b0f90572c4b6bd9a5a52e5765 /etc | |
parent | 5f2ad49702d5625434eb3b6b14ecc88a8a2da831 (diff) | |
download | pfsense-eb9aae6f5f498c70d4879249dcd5537899b7661c.zip pfsense-eb9aae6f5f498c70d4879249dcd5537899b7661c.tar.gz |
MFC 10300
Handle both communication and XMLRPC related errors.
Ticket #855
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 9ef427b..0c48bc8 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1173,11 +1173,15 @@ function call_pfsense_method($method, $params, $timeout = 0) { $msg = new XML_RPC_Message($method, array(XML_RPC_Encode($params))); $cli = new XML_RPC_Client($xmlrpc_path, $xmlrpc_base_url); $resp = $cli->send($msg, $timeout); - if(!$resp or $resp->faultCode()) { + if(!$resp) { + log_error("XMLRPC communication error: " . $cli->errstr); + return false; + } elseif($resp->faultCode()) { log_error("XMLRPC request failed with error " . $resp->faultCode() . ": " . $resp->faultString()); return false; + } else { + return XML_RPC_Decode($resp->value()); } - return XML_RPC_Decode($resp->value()); } /* @@ -1710,4 +1714,4 @@ function print_value_list($list, $count = 10, $separator = ",") { return $list; } -?>
\ No newline at end of file +?> |