Merge pull request #71 from pylebecq/convert-exceptions-to-soapfaults

[Controller] Any kind of exception are now re-thrown as SoapFault. (fixes #70)
This commit is contained in:
Francis Besset 2013-07-17 02:27:17 -07:00
commit e99f707b10
1 changed files with 6 additions and 2 deletions

View File

@ -123,10 +123,14 @@ class SoapWebServiceController extends ContainerAware
// forward to controller
try {
$response = $this->container->get('http_kernel')->handle($this->soapRequest, HttpKernelInterface::SUB_REQUEST, false);
} catch (\SoapFault $e) {
} catch (\Exception $e) {
$this->soapResponse = new Response(null, 500);
throw $e;
if ($e instanceof \SoapFault || $this->container->getParameter('kernel.debug')) {
throw $e;
}
throw new \SoapFault('Receiver', $e->getMessage());
}
$this->setResponse($response);