Skip to content

Commit 798ede5

Browse files
authored
Ensure exceptions have event_type if they are used in event streams (#2943)
1 parent a90b76b commit 798ede5

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/client_api_module.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class ClientApiModule < View
4444
'box' => false,
4545
'fault' => false,
4646
'error' => false,
47+
'exception_event' => false, # internal, exceptions cannot be events
4748
'deprecated' => false,
4849
'deprecatedMessage' => false,
4950
'type' => false,

build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/types_module.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ def module_name
2828

2929
# @return [Array<StructClass>]
3030
def structures
31-
unless @service.protocol_settings.empty?
32-
if @service.protocol_settings['h2'] == 'eventstream'
33-
@service.api['shapes'].each do |_, shape|
34-
if shape['eventstream']
35-
# add event trait to all members if not exists
36-
shape['members'].each do |name, ref|
37-
@service.api['shapes'][ref['shape']]['event'] = true
38-
end
31+
@service.api['shapes'].each do |_, shape|
32+
if shape['eventstream']
33+
# add internal exception_event ctrait to all exceptions
34+
# exceptions will not have the event trait.
35+
shape['members'].each do |name, ref|
36+
if !!@service.api['shapes'][ref['shape']]['exception']
37+
@service.api['shapes'][ref['shape']]['exception_event'] = true
3938
end
4039
end
4140
end
@@ -93,7 +92,7 @@ def struct_members(shape)
9392
sensitive: sensitive
9493
)
9594
end
96-
if shape['event']
95+
if shape['event'] || shape['exception_event']
9796
members << StructMember.new(member_name: 'event_type')
9897
end
9998
members

gems/aws-sdk-bedrockruntime/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Unreleased Changes
22
------------------
33

4+
* Issue - Fix exception handling with event streaming operations.
5+
46
1.1.0 (2023-10-02)
57
------------------
68

gems/aws-sdk-sagemakerruntime/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Unreleased Changes
22
------------------
33

4+
* Issue - Fix exception handling with event streaming operations.
5+
46
1.56.0 (2023-09-27)
57
------------------
68

0 commit comments

Comments
 (0)