Skip to content

Commit c96bcda

Browse files
committed
update code
1 parent 30bc303 commit c96bcda

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/code/Magento/Webapi/Controller/Rest/SynchronousRequestProcessor.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Webapi\Controller\Rest;
99

10+
use Magento\Framework\Webapi\Exception as WebapiException;
1011
use Magento\Framework\Webapi\Rest\Response as RestResponse;
1112
use Magento\Framework\Webapi\ServiceOutputProcessor;
1213
use Magento\Framework\Webapi\Rest\Response\FieldsFilter;
@@ -92,7 +93,11 @@ 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+
$outputData = call_user_func_array([$service, $serviceMethodName], $inputParams);
98+
} catch (\Throwable $e) {
99+
throw new WebapiException(__($e->getMessage()));
100+
}
96101
$outputData = $this->serviceOutputProcessor->process(
97102
$outputData,
98103
$serviceClassName,

lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\Framework\Webapi;
99

10-
use Laminas\Code\Reflection\ClassReflection;
1110
use Magento\Framework\Api\AttributeValue;
1211
use Magento\Framework\Api\AttributeValueFactory;
1312
use Magento\Framework\Api\SearchCriteriaInterface;
@@ -23,8 +22,9 @@
2322
use Magento\Framework\Phrase;
2423
use Magento\Framework\Reflection\MethodsMap;
2524
use Magento\Framework\Reflection\TypeProcessor;
26-
use Magento\Framework\Webapi\CustomAttribute\PreprocessorInterface;
2725
use Magento\Framework\Webapi\Exception as WebapiException;
26+
use Magento\Framework\Webapi\CustomAttribute\PreprocessorInterface;
27+
use Laminas\Code\Reflection\ClassReflection;
2828
use Magento\Framework\Webapi\Validator\IOLimit\DefaultPageSizeSetter;
2929
use Magento\Framework\Webapi\Validator\ServiceInputValidatorInterface;
3030

@@ -564,8 +564,6 @@ private function processComplexTypes($data, $type)
564564

565565
if (!$isArrayType) {
566566
return $this->_createFromArray($type, $data);
567-
} elseif (!is_array($data)) {
568-
throw new InvalidArgumentException(__('Not all parameters valid.'));
569567
}
570568

571569
$result = is_array($data) ? [] : null;

0 commit comments

Comments
 (0)