1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2018 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
declare (strict_types=1 );
7
7
8
8
namespace Magento \Webapi \Controller \Rest ;
9
9
10
+ use Magento \Framework \Webapi \Exception as WebapiException ;
10
11
use Magento \Framework \Webapi \Rest \Response as RestResponse ;
11
12
use Magento \Framework \Webapi \ServiceOutputProcessor ;
12
13
use Magento \Framework \Webapi \Rest \Response \FieldsFilter ;
19
20
*/
20
21
class SynchronousRequestProcessor implements RequestProcessorInterface
21
22
{
22
- const PROCESSOR_PATH = "/^ \\/V \\d+/ " ;
23
+ public const PROCESSOR_PATH = "/^ \\/V \\d+/ " ;
23
24
24
25
/**
25
26
* @var RestResponse
@@ -78,7 +79,7 @@ public function __construct(
78
79
}
79
80
80
81
/**
81
- * { @inheritdoc}
82
+ * @inheritdoc
82
83
*/
83
84
public function process (\Magento \Framework \Webapi \Rest \Request $ request )
84
85
{
@@ -92,7 +93,13 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
92
93
/**
93
94
* @var \Magento\Framework\Api\AbstractExtensibleObject $outputData
94
95
*/
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
+ }
96
103
$ outputData = $ this ->serviceOutputProcessor ->process (
97
104
$ outputData ,
98
105
$ serviceClassName ,
@@ -109,7 +116,7 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
109
116
}
110
117
111
118
/**
112
- * { @inheritdoc}
119
+ * @inheritdoc
113
120
*/
114
121
public function canProcess (\Magento \Framework \Webapi \Rest \Request $ request )
115
122
{
0 commit comments