File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
app/code/Magento/Webapi/Controller/Rest Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1313use Magento \Framework \App \DeploymentConfig ;
1414use Magento \Framework \ObjectManagerInterface ;
1515use Magento \Framework \Config \ConfigOptionsListConstants ;
16+ use Magento \Framework \Phrase ;
17+ use Magento \Framework \Webapi \Exception as WebapiException ;
1618
1719/**
1820 * REST request processor for synchronous requests
@@ -92,7 +94,17 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
9294 /**
9395 * @var \Magento\Framework\Api\AbstractExtensibleObject $outputData
9496 */
95- $ outputData = call_user_func_array ([$ service , $ serviceMethodName ], $ inputParams );
97+ try {
98+ $ outputData = call_user_func_array ([$ service , $ serviceMethodName ], $ inputParams );
99+ } catch (\Exception $ e ) {
100+ // Re-throw other exceptions as WebapiException with 400 status code
101+ throw new WebapiException (
102+ new Phrase ($ e ->getMessage ()),
103+ 0 ,
104+ WebapiException::HTTP_BAD_REQUEST
105+ );
106+ }
107+
96108 $ outputData = $ this ->serviceOutputProcessor ->process (
97109 $ outputData ,
98110 $ serviceClassName ,
You can’t perform that action at this time.
0 commit comments