Added generateHttpResponse method to exception

This commit is contained in:
Alex Bilbie 2015-04-05 18:16:21 +01:00
parent 26c1abdd3c
commit 72b741d7c9

View File

@ -127,4 +127,22 @@ class OAuthException extends \Exception
// @codeCoverageIgnoreEnd
return $headers;
}
/**
* Generate a HTTP response
* @return \Symfony\Component\HttpFoundation\Response
*/
public function generateHttpResponse()
{
return new Response(
json_encode(
[
'error' => $this->errorType,
'message' => $this->getMessage()
]
),
$this->httpStatusCode,
$this->getHttpHeaders()
);
}
}