Skip to content

Commit cf6ecb2

Browse files
committed
AC-746: Malformed request body or parameters cause Internal Server Error
1 parent 0d5e50b commit cf6ecb2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

dev/tests/api-functional/testsuite/Magento/Framework/Webapi/ApiErrorProcessorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function malformedRequestParamsDataProvider()
8484
]
8585
],
8686
'endpoint' => 'eav/attribute-sets/list',
87-
'expectedExceptionCode' => 500,
87+
'expectedExceptionCode' => 400,
8888
],
8989
'empty_filter_groups_value' => [
9090
'requestData' => [
@@ -118,7 +118,7 @@ public static function malformedRequestParamsDataProvider()
118118
]
119119
],
120120
'endpoint' => 'cmsBlock/search',
121-
'expectedExceptionCode' => 500,
121+
'expectedExceptionCode' => 400,
122122
],
123123
'empty_filter_groups_value2' => [
124124
'requestData' => [

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ private function getClientErrorHttpCode(\Exception $exception)
179179
{
180180
// Check if this is a client error based on the exception type
181181
if ($exception instanceof \Zend_Db_Exception
182+
|| $exception instanceof \Exception
182183
|| $exception instanceof \Zend_Db_Adapter_Exception
183184
|| $exception instanceof \Zend_Db_Statement_Exception
184185
|| $exception instanceof \PDOException

0 commit comments

Comments
 (0)