From 7e38326028a4d2419fa553723c4eef4bd4c90495 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sat, 6 Oct 2018 16:02:05 +0200 Subject: [PATCH] throw exception code from previous exception --- .../Magento/Framework/Communication/Config/Validator.php | 5 ++--- .../Test/Unit/Communication/Config/ValidatorTest.php | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Communication/Config/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Validator.php index c3b2d03089f49..0bd3763028def 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Validator.php @@ -13,7 +13,6 @@ */ class Validator { - const INVALID_ANNOTATIONS = 123; /** * @var TypeProcessor */ @@ -50,7 +49,7 @@ public function validateResponseSchemaType($responseSchema, $topicName) } catch (\InvalidArgumentException $e) { throw new \LogicException( 'Response schema definition has wrong annotations', - self::INVALID_ANNOTATIONS, + $e->getCode(), $e ); } catch (\Exception $e) { @@ -77,7 +76,7 @@ public function validateRequestSchemaType($requestSchema, $topicName) } catch (\InvalidArgumentException $e) { throw new \LogicException( 'Response schema definition has wrong annotations', - self::INVALID_ANNOTATIONS, + $e->getCode(), $e ); } catch (\Exception $e) { diff --git a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php index 633cf7b6abbf3..c440d39f0188b 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php @@ -17,7 +17,7 @@ public function setUp() $this->methodsMap->expects(static::any()) ->method('getMethodsMap') - ->will($this->throwException(new \InvalidArgumentException())); + ->will($this->throwException(new \InvalidArgumentException('message', 333))); $this->typeProcessor = $this->createMock(TypeProcessor::class); @@ -32,7 +32,7 @@ public function setUp() /** * @expectedException \LogicException - * @expectedExceptionCode 123 + * @expectedExceptionCode 333 */ public function testValidateResponseSchemaType() { @@ -43,7 +43,7 @@ public function testValidateResponseSchemaType() /** * @expectedException \LogicException - * @expectedExceptionCode 123 + * @expectedExceptionCode 333 */ public function testValidateRequestSchemaType() {