diff --git a/src/Exception/IDPException.php b/src/Exception/IDPException.php index 36eae2a..f2297f5 100644 --- a/src/Exception/IDPException.php +++ b/src/Exception/IDPException.php @@ -25,6 +25,11 @@ class IDPException extends \Exception parent::__construct($message, $code); } + public function getResponseBody() + { + return $this->result; + } + public function getType() { $result = 'Exception'; diff --git a/test/src/Exception/IDPExceptionTest.php b/test/src/Exception/IDPExceptionTest.php index 3debc62..612869d 100644 --- a/test/src/Exception/IDPExceptionTest.php +++ b/test/src/Exception/IDPExceptionTest.php @@ -41,4 +41,17 @@ class IDPExceptionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('message: 404: message', (string)$exception); } -} \ No newline at end of file + + public function testGetResponseBody() + { + $exception = new IDPException(array('error' => 'message', 'code' => 404)); + + $this->assertEquals( + [ + 'error' => 'message', + 'code' => 404 + ], + $exception->getResponseBody() + ); + } +}