Skip to content

Commit 59498a6

Browse files
committed
Merge pull request #1 from Cyrille37/master
Add root namespace on Exception class
2 parents a772d7d + 37a3bad commit 59498a6

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

org/jsonrpcphp/JsonRPCClient.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ public function __call($method,$params) {
101101

102102
// check
103103
if (!is_scalar($method)) {
104-
throw new Exception('Method name has no scalar value');
104+
throw new \Exception('Method name has no scalar value');
105105
}
106106

107107
// check
108108
if (is_array($params)) {
109109
// no keys
110110
$params = array_values($params);
111111
} else {
112-
throw new Exception('Params must be given as array');
112+
throw new \Exception('Params must be given as array');
113113
}
114114

115115
// sets notification or request task
@@ -146,7 +146,7 @@ public function __call($method,$params) {
146146
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
147147
$response = curl_exec($ch);
148148
if ( $response === false ) {
149-
throw new Exception('Unable to connect to '.$this->url);
149+
throw new \Exception('Unable to connect to '.$this->url);
150150
}
151151
} else {
152152
if ($fp = fopen($this->url, 'r', false, $context)) {
@@ -155,7 +155,7 @@ public function __call($method,$params) {
155155
$response.= trim($row)."\n";
156156
}
157157
} else {
158-
throw new Exception('Unable to connect to '.$this->url);
158+
throw new \Exception('Unable to connect to '.$this->url);
159159
}
160160
}
161161
$this->debug && $this->debug.='***** Response *****'."\n".$response."\n".'***** End of Response *****'."\n\n";
@@ -184,4 +184,4 @@ public function __call($method,$params) {
184184
}
185185
}
186186
}
187-
?>
187+
?>

org/jsonrpcphp/JsonRPCServer.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function handle( $object ) {
5858
$response = array ( 'id' => $request['id'], 'result' => NULL, 'error' => NULL );
5959
try {
6060
$response['result'] = call_user_func_array( array( $object, $request['method']), $request['params']);
61-
} catch (Exception $e) {
61+
} catch (\Exception $e) {
6262
$response['result'] = null;
6363
$response['error'] = $e->getMessage();
6464
}
@@ -74,4 +74,4 @@ public static function handle( $object ) {
7474
}
7575
}
7676
}
77-
?>
77+
?>

0 commit comments

Comments
 (0)