/** * Check if an exception satisfies a success or failure acceptor. * * @param SdkException $e * @param array $config * * @return bool|null true/false for success/failure; null for no transition */ private function checkErrorAcceptor(SdkException $e, array $config) { if ($config['success_type'] == 'error' && $e->getApiErrorCode() == $config['success_value']) { // Mark as a success return true; } // Mark as an attempt return null; }
public function testProvidesContextShortcuts() { $coll = ['api_error' => ['request_id' => '10', 'type' => 'mytype', 'code' => 'mycode']]; $client = $this->getTestClient('product'); $trans = new CommandTransaction($client, new Command('foo'), $coll); $exception = new SdkException('Foo', $trans); $this->assertEquals('10', $exception->getApiRequestId()); $this->assertEquals('10', $exception->getRequestId()); $this->assertEquals('mytype', $exception->getApiErrorType()); $this->assertEquals('mytype', $exception->getExceptionType()); $this->assertEquals('mycode', $exception->getApiErrorCode()); $this->assertEquals('mycode', $exception->getExceptionCode()); }