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:
commit
e99f707b10
|
@ -123,12 +123,16 @@ class SoapWebServiceController extends ContainerAware
|
||||||
// forward to controller
|
// forward to controller
|
||||||
try {
|
try {
|
||||||
$response = $this->container->get('http_kernel')->handle($this->soapRequest, HttpKernelInterface::SUB_REQUEST, false);
|
$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);
|
$this->soapResponse = new Response(null, 500);
|
||||||
|
|
||||||
|
if ($e instanceof \SoapFault || $this->container->getParameter('kernel.debug')) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new \SoapFault('Receiver', $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
$this->setResponse($response);
|
$this->setResponse($response);
|
||||||
|
|
||||||
// add response soap headers to soap server
|
// add response soap headers to soap server
|
||||||
|
|
Loading…
Reference in New Issue