Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7bcb786

Browse files
authored
Generate Exceptions (#921)
* Generate Exceptions * Add documentation on top of class * Leverage the new AwsErrorFactory * Fix __constructor signature in GeneratedException * Fix private vs protected * Generate all methods * Fix things * Add constraint in composer.Json * Add changelog entry
1 parent e53c79d commit 7bcb786

4 files changed

Lines changed: 20 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Changed case of object's properties to camelCase.
88
- Added documentation in class's headers.
9+
- Added Business Exceptions.
910

1011
## 1.0.1
1112

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"require": {
1414
"php": "^7.2.5 || ^8.0",
1515
"ext-json": "*",
16-
"async-aws/core": "^1.2"
16+
"async-aws/core": "^1.9"
1717
},
1818
"extra": {
1919
"branch-alias": {

src/EventBridgeClient.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use AsyncAws\Core\AwsError\JsonRpcAwsErrorFactory;
88
use AsyncAws\Core\Configuration;
99
use AsyncAws\Core\RequestContext;
10+
use AsyncAws\EventBridge\Exception\InternalException;
1011
use AsyncAws\EventBridge\Input\PutEventsRequest;
1112
use AsyncAws\EventBridge\Result\PutEventsResponse;
1213
use AsyncAws\EventBridge\ValueObject\PutEventsRequestEntry;
@@ -23,11 +24,15 @@ class EventBridgeClient extends AbstractApi
2324
* Entries: PutEventsRequestEntry[],
2425
* @region?: string,
2526
* }|PutEventsRequest $input
27+
*
28+
* @throws InternalException
2629
*/
2730
public function putEvents($input): PutEventsResponse
2831
{
2932
$input = PutEventsRequest::create($input);
30-
$response = $this->getResponse($input->request(), new RequestContext(['operation' => 'PutEvents', 'region' => $input->getRegion()]));
33+
$response = $this->getResponse($input->request(), new RequestContext(['operation' => 'PutEvents', 'region' => $input->getRegion(), 'exceptionMapping' => [
34+
'InternalException' => InternalException::class,
35+
]]));
3136

3237
return new PutEventsResponse($response);
3338
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace AsyncAws\EventBridge\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* This exception occurs due to unexpected causes.
9+
*/
10+
final class InternalException extends ClientException
11+
{
12+
}

0 commit comments

Comments
 (0)