Skip to content
This repository has been archived by the owner on May 13, 2018. It is now read-only.

Commit

Permalink
Added exception handling to the json-rpc server
Browse files Browse the repository at this point in the history
git-svn-id: http://goodold.googlecode.com/svn/drupal_modules/jsonrpc_server/trunk@180 b8d441e5-9555-0410-8e75-7fea32d02d5f
  • Loading branch information
hugowetterberg committed Sep 15, 2008
1 parent 6486d7f commit 36cf8b5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions JsonRpcServer.php
Expand Up @@ -140,13 +140,18 @@ public function handle() {
}

//Call service method
$result = services_method_call($this->method['#method'], $this->args);
if (is_array($result) && isset($result['#error']) && $result['#error'] === TRUE) {
return $this->error(JSONRPC_ERROR_INTERNAL_ERROR, $result['#message']);
}
else {
return $this->result($result);
try {
$result = services_method_call($this->method['#method'], $this->args);
if (is_array($result) && isset($result['#error']) && $result['#error'] === TRUE) {
return $this->error(JSONRPC_ERROR_INTERNAL_ERROR, $result['#message']);
}
else {
return $this->result($result);
}
} catch (Exception $e) {
return $this->error(JSONRPC_ERROR_INTERNAL_ERROR, $e->getMessage());
}

}

private function array_is_assoc(&$arr) {
Expand Down

0 comments on commit 36cf8b5

Please sign in to comment.