Skip to content

Commit bc333c9

Browse files
author
diabl0
committed
Arango connection errors
1 parent c1bb3a7 commit bc333c9

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

lib/ArangoDBClient/ClientException.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,62 @@ public function __toString()
3333
{
3434
return __CLASS__ . ': ' . $this->getMessage();
3535
}
36+
37+
protected $method, $url, $data;
38+
39+
/**
40+
* @return mixed
41+
*/
42+
public function getMethod()
43+
{
44+
return $this->method;
45+
}
46+
47+
/**
48+
* @param mixed $method
49+
* @return ClientException
50+
*/
51+
public function setMethod($method)
52+
{
53+
$this->method = $method;
54+
return $this;
55+
}
56+
57+
/**
58+
* @return mixed
59+
*/
60+
public function getUrl()
61+
{
62+
return $this->url;
63+
}
64+
65+
/**
66+
* @param mixed $url
67+
* @return ClientException
68+
*/
69+
public function setUrl($url)
70+
{
71+
$this->url = $url;
72+
return $this;
73+
}
74+
75+
/**
76+
* @return mixed
77+
*/
78+
public function getData()
79+
{
80+
return $this->data;
81+
}
82+
83+
/**
84+
* @param mixed $data
85+
* @return ClientException
86+
*/
87+
public function setData($data)
88+
{
89+
$this->data = $data;
90+
return $this;
91+
}
3692
}
3793

3894
class_alias(ClientException::class, '\triagens\ArangoDb\ClientException');

lib/ArangoDBClient/Connection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,9 @@ private function executeRequest($method, $url, $data, array $customHeaders = [])
467467

468468
$status = socket_get_status($handle);
469469
if ($status['timed_out']) {
470-
throw new ClientException('Got a timeout while waiting for the server\'s response', 408);
470+
$exception = new ClientException('Got a timeout while waiting for the server\'s response', 408);
471+
$exception->setUrl($url)->setMethod($method)->setData($data);
472+
throw $exception;
471473
}
472474

473475
if (!$this->_useKeepAlive) {

0 commit comments

Comments
 (0)