11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2018 Adobe
4+ * All Rights Reserved .
55 */
66declare (strict_types=1 );
77
88namespace Magento \Webapi \Controller \Rest ;
99
10+ use Magento \Framework \Webapi \Exception as WebapiException ;
1011use Magento \Framework \Webapi \Rest \Response as RestResponse ;
1112use Magento \Framework \Webapi \ServiceOutputProcessor ;
1213use Magento \Framework \Webapi \Rest \Response \FieldsFilter ;
1920 */
2021class SynchronousRequestProcessor implements RequestProcessorInterface
2122{
22- const PROCESSOR_PATH = "/^ \\/V \\d+/ " ;
23+ public const PROCESSOR_PATH = "/^ \\/V \\d+/ " ;
2324
2425 /**
2526 * @var RestResponse
@@ -78,7 +79,7 @@ public function __construct(
7879 }
7980
8081 /**
81- * { @inheritdoc}
82+ * @inheritdoc
8283 */
8384 public function process (\Magento \Framework \Webapi \Rest \Request $ request )
8485 {
@@ -92,7 +93,13 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
9293 /**
9394 * @var \Magento\Framework\Api\AbstractExtensibleObject $outputData
9495 */
95- $ outputData = call_user_func_array ([$ service , $ serviceMethodName ], $ inputParams );
96+ try {
97+ // phpcs:disable Magento2.Functions.DiscouragedFunction
98+ $ outputData = call_user_func_array ([$ service , $ serviceMethodName ], $ inputParams );
99+ // phpcs:enable Magento2.Functions.DiscouragedFunction
100+ } catch (\TypeError $ e ) {
101+ throw new WebapiException (__ ($ e ->getMessage ()));
102+ }
96103 $ outputData = $ this ->serviceOutputProcessor ->process (
97104 $ outputData ,
98105 $ serviceClassName ,
@@ -109,7 +116,7 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
109116 }
110117
111118 /**
112- * { @inheritdoc}
119+ * @inheritdoc
113120 */
114121 public function canProcess (\Magento \Framework \Webapi \Rest \Request $ request )
115122 {
0 commit comments