diff --git a/lib/ArangoDBClient/Batch.php b/lib/ArangoDBClient/Batch.php index 840ce696..f565f4fc 100644 --- a/lib/ArangoDBClient/Batch.php +++ b/lib/ArangoDBClient/Batch.php @@ -569,10 +569,12 @@ public function getConnection() * Sets the document class to use * * @param string $class Document class to use + * @return Batch */ public function setDocumentClass($class) { $this->_documentClass = $class; + return $this; } } diff --git a/lib/ArangoDBClient/BatchPart.php b/lib/ArangoDBClient/BatchPart.php index 7e681290..4ef1938e 100644 --- a/lib/ArangoDBClient/BatchPart.php +++ b/lib/ArangoDBClient/BatchPart.php @@ -347,10 +347,12 @@ private function getCursorOptions() * Sets the document class to use * * @param string $class Document class to use + * @return BatchPart */ public function setDocumentClass($class) { $this->_documentClass = $class; + return $this; } } diff --git a/lib/ArangoDBClient/ClientException.php b/lib/ArangoDBClient/ClientException.php index 1311c927..eb1ea150 100644 --- a/lib/ArangoDBClient/ClientException.php +++ b/lib/ArangoDBClient/ClientException.php @@ -33,6 +33,62 @@ public function __toString() { return __CLASS__ . ': ' . $this->getMessage(); } + + protected $method, $url, $data; + + /** + * @return mixed + */ + public function getMethod() + { + return $this->method; + } + + /** + * @param mixed $method + * @return ClientException + */ + public function setMethod($method) + { + $this->method = $method; + return $this; + } + + /** + * @return mixed + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param mixed $url + * @return ClientException + */ + public function setUrl($url) + { + $this->url = $url; + return $this; + } + + /** + * @return mixed + */ + public function getData() + { + return $this->data; + } + + /** + * @param mixed $data + * @return ClientException + */ + public function setData($data) + { + $this->data = $data; + return $this; + } } class_alias(ClientException::class, '\triagens\ArangoDb\ClientException'); diff --git a/lib/ArangoDBClient/Connection.php b/lib/ArangoDBClient/Connection.php index 5966ac8e..374dbd05 100644 --- a/lib/ArangoDBClient/Connection.php +++ b/lib/ArangoDBClient/Connection.php @@ -467,7 +467,9 @@ private function executeRequest($method, $url, $data, array $customHeaders = []) $status = socket_get_status($handle); if ($status['timed_out']) { - throw new ClientException('Got a timeout while waiting for the server\'s response', 408); + $exception = new ClientException('Got a timeout while waiting for the server\'s response', 408); + $exception->setUrl($url)->setMethod($method)->setData($data); + throw $exception; } if (!$this->_useKeepAlive) { diff --git a/lib/ArangoDBClient/ConnectionOptions.php b/lib/ArangoDBClient/ConnectionOptions.php index 7f6c00e3..feb454e5 100644 --- a/lib/ArangoDBClient/ConnectionOptions.php +++ b/lib/ArangoDBClient/ConnectionOptions.php @@ -375,6 +375,7 @@ private function validate() if (isset($this->_values[self::OPTION_HOST]) && !isset($this->_values[self::OPTION_ENDPOINT])) { // upgrade host/port to an endpoint $this->_values[self::OPTION_ENDPOINT] = 'tcp://' . $this->_values[self::OPTION_HOST] . ':' . $this->_values[self::OPTION_PORT]; + unset($this->_values[self::OPTION_HOST]); } } diff --git a/lib/ArangoDBClient/Cursor.php b/lib/ArangoDBClient/Cursor.php index 7953559a..2e1916c8 100644 --- a/lib/ArangoDBClient/Cursor.php +++ b/lib/ArangoDBClient/Cursor.php @@ -836,10 +836,12 @@ public function getId() * Sets the document class to use * * @param string $class Document class to use + * @return Cursor */ public function setDocumentClass($class) { $this->_documentClass = $class; + return $this; } } diff --git a/lib/ArangoDBClient/Export.php b/lib/ArangoDBClient/Export.php index 7cc417a6..2f074b3d 100644 --- a/lib/ArangoDBClient/Export.php +++ b/lib/ArangoDBClient/Export.php @@ -274,10 +274,12 @@ private function getCursorOptions() * Sets the document class to use * * @param string $class Document class to use + * @return Export */ public function setDocumentClass($class) { $this->_documentClass = $class; + return $this; } } diff --git a/lib/ArangoDBClient/ExportCursor.php b/lib/ArangoDBClient/ExportCursor.php index a299a023..75c253c3 100644 --- a/lib/ArangoDBClient/ExportCursor.php +++ b/lib/ArangoDBClient/ExportCursor.php @@ -290,10 +290,12 @@ public function getId() * Sets the document class to use * * @param string $class Document class to use + * @return ExportCursor */ public function setDocumentClass($class) { $this->_documentClass = $class; + return $this; } } diff --git a/lib/ArangoDBClient/Handler.php b/lib/ArangoDBClient/Handler.php index 3d094d8b..88e44a56 100644 --- a/lib/ArangoDBClient/Handler.php +++ b/lib/ArangoDBClient/Handler.php @@ -166,10 +166,12 @@ protected function makeCollection($value) * Sets the document class to use * * @param string $class Document class to use + * @return Handler */ public function setDocumentClass($class) { $this->_documentClass = $class; + return $this; } } diff --git a/lib/ArangoDBClient/Statement.php b/lib/ArangoDBClient/Statement.php index 928e6f72..066fa896 100644 --- a/lib/ArangoDBClient/Statement.php +++ b/lib/ArangoDBClient/Statement.php @@ -558,10 +558,12 @@ private function getCursorOptions() * Sets the document class to use * * @param string $class Document class to use + * @return Statement */ public function setDocumentClass($class) { $this->_documentClass = $class; + return $this; } }