Added getResponseBody method in IDPException
Problem: Some providers are sending additional information when an error occurs, which can't be accessed because property `$result` is protected. Solution: Data from this property can be accessed using `getResponseBody()` method. Closes #185oauth1test
parent
a86dbd4e58
commit
c0f8ebf920
|
@ -25,6 +25,11 @@ class IDPException extends \Exception
|
|||
parent::__construct($message, $code);
|
||||
}
|
||||
|
||||
public function getResponseBody()
|
||||
{
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
$result = 'Exception';
|
||||
|
|
|
@ -41,4 +41,17 @@ class IDPExceptionTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->assertEquals('message: 404: message', (string)$exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetResponseBody()
|
||||
{
|
||||
$exception = new IDPException(array('error' => 'message', 'code' => 404));
|
||||
|
||||
$this->assertEquals(
|
||||
[
|
||||
'error' => 'message',
|
||||
'code' => 404
|
||||
],
|
||||
$exception->getResponseBody()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue