Various Thrift fixes, including Application Exception support in Ruby, better errror messages across languages, etc.
Reviewed By: thrift
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665058 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/php/src/transport/TSocket.php b/lib/php/src/transport/TSocket.php
index 1600b6f..cce3a44 100644
--- a/lib/php/src/transport/TSocket.php
+++ b/lib/php/src/transport/TSocket.php
@@ -160,7 +160,7 @@
if ($this->debug_) {
call_user_func($this->debugHandler_, $error);
}
- throw new Exception($error);
+ throw new TException($error);
}
stream_set_timeout($this->handle_, 0, $this->sendTimeout_*1000);
@@ -197,17 +197,17 @@
if ($buf === FALSE || $buf === '') {
$md = stream_get_meta_data($this->handle_);
if ($md['timed_out']) {
- throw new Exception('TSocket: timed out reading '.$len.' bytes from '.
- $this->host_.':'.$this->port_);
+ throw new TException('TSocket: timed out reading '.$len.' bytes from '.
+ $this->host_.':'.$this->port_);
} else {
- throw new Exception('TSocket: Could not read '.$len.' bytes from '.
- $this->host_.':'.$this->port_);
+ throw new TException('TSocket: Could not read '.$len.' bytes from '.
+ $this->host_.':'.$this->port_);
}
} else if (($sz = strlen($buf)) < $len) {
$md = stream_get_meta_data($this->handle_);
if ($md['timed_out']) {
- throw new Exception('TSocket: timed out reading '.$len.' bytes from '.
- $this->host_.':'.$this->port_);
+ throw new TException('TSocket: timed out reading '.$len.' bytes from '.
+ $this->host_.':'.$this->port_);
} else {
$pre .= $buf;
$len -= $sz;
@@ -233,11 +233,11 @@
if ($data === FALSE || $data === '') {
$md = stream_get_meta_data($this->handle_);
if ($md['timed_out']) {
- throw new Exception('TSocket: timed out reading '.$len.' bytes from '.
- $this->host_.':'.$this->port_);
+ throw new TException('TSocket: timed out reading '.$len.' bytes from '.
+ $this->host_.':'.$this->port_);
} else {
- throw new Exception('TSocket: Could not read '.$len.' bytes from '.
- $this->host_.':'.$this->port_);
+ throw new TException('TSocket: Could not read '.$len.' bytes from '.
+ $this->host_.':'.$this->port_);
}
}
return $data;
@@ -258,11 +258,11 @@
if ($got === 0 || $got === FALSE) {
$md = stream_get_meta_data($this->handle_);
if ($md['timed_out']) {
- throw new Exception('TSocket: timed out writing '.$len.' bytes from '.
- $this->host_.':'.$this->port_);
+ throw new TException('TSocket: timed out writing '.$len.' bytes from '.
+ $this->host_.':'.$this->port_);
} else {
- throw new Exception('TSocket: Could not write '.strlen($buf).' bytes '.
- $this->host_.':'.$this->port_);
+ throw new TException('TSocket: Could not write '.strlen($buf).' bytes '.
+ $this->host_.':'.$this->port_);
}
}
$buf = substr($buf, $got);
@@ -275,8 +275,8 @@
public function flush() {
$ret = fflush($this->handle_);
if ($ret === FALSE) {
- throw new Exception('TSocket: Could not flush: '.
- $this->host_.':'.$this->port_);
+ throw new TException('TSocket: Could not flush: '.
+ $this->host_.':'.$this->port_);
}
}
}