Skip to content

Commit 0540eb2

Browse files
Merge pull request #201 from joveice/noridmessages
get original response in exception
2 parents 932715e + 20aca00 commit 0540eb2

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Protocols/EPP/eppException.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ class eppException extends \Exception {
1414
* @var string
1515
*/
1616
private $lastcommand = null;
17+
/**
18+
* @var $response
19+
*/
20+
private $response = null;
1721

1822
/**
1923
* eppException constructor.
@@ -23,8 +27,9 @@ class eppException extends \Exception {
2327
* @param string $reason
2428
* @param int $id
2529
* @param string $command
30+
* @param \Metaregistrar\EPP\eppResponse|null $response
2631
*/
27-
public function __construct($message = "", $code = 0, \Exception $previous = null, $reason = null, $command = null) {
32+
public function __construct($message = "", $code = 0, \Exception $previous = null, $reason = null, $command = null, $response = null) {
2833
$this->reason = $reason;
2934
$trace = $this->getTrace();
3035
$this->class = null;
@@ -35,6 +40,7 @@ public function __construct($message = "", $code = 0, \Exception $previous = nul
3540
/* @var $class \Metaregistrar\EPP\eppRequest */
3641
$this->lastcommand = $command;
3742
}
43+
$this->response = $response;
3844
parent::__construct($message, $code, $previous);
3945
}
4046

@@ -58,5 +64,12 @@ public function getClass() {
5864
public function getReason() {
5965
return $this->reason;
6066
}
67+
68+
/**
69+
* @return \Metaregistrar\EPP\eppResponse|null
70+
*/
71+
public function getResponse() {
72+
return $this->response;
73+
}
6174
}
6275

Protocols/EPP/eppResponses/eppResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ public function Success() {
182182
}
183183
if ((is_array($this->exceptions)) && (count($this->exceptions)>0)) {
184184
foreach ($this->exceptions as $exceptionhandler) {
185-
throw new $exceptionhandler($errorstring, $resultcode, null, $resultreason, $this->saveXML());
185+
throw new $exceptionhandler($errorstring, $resultcode, null, $resultreason, $this->saveXML(), $this);
186186
}
187187
} else {
188-
throw new eppException($errorstring, $resultcode, null, $resultreason, $this->saveXML());
188+
throw new eppException($errorstring, $resultcode, null, $resultreason, $this->saveXML(), $this);
189189
}
190190

191191
} else {

0 commit comments

Comments
 (0)