Skip to content

Commit

Permalink
Clarify that event streams contain modeled errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Aug 16, 2021
1 parent 562a88e commit 14d19d0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/source/1.0/spec/core/stream-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,20 @@ stream in its output:
down: Movement,
left: Movement,
right: Movement,
throttlingError: ThrottlingError
}

structure Movement {
velocity: Float,
}

/// An example error emitted when the client is throttled
/// and should terminate the event stream.
@error("client")
@retryable(throttling: true)
structure ThrottlingError {}


.. code-tab:: json

{
Expand Down Expand Up @@ -253,6 +261,9 @@ stream in its output:
},
"right": {
"target": "smithy.example#Movement"
},
"throttlingError": {
"target": "smithy.example#ThrottlingError"
}
},
"traits": {
Expand All @@ -266,11 +277,29 @@ stream in its output:
"target": "smithy.api#Float"
}
}
},
"smithy.example#ThrottlingError": {
"type": "structure",
"traits": {
"smithy.api#documentation": "An example error emitted when the client is throttled and should terminate the event stream.",
"smithy.api#error": "client",
"smithy.api#retryable": {
"throttling": true
}
}
}
}
}


Modeled errors in event streams
===============================

Event streams MAY target shapes marked with the :ref:`error-trait`. These
events are considered terminal errors and MUST terminate the event stream
when received.


.. _initial-messages:

Initial messages
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace smithy.example

operation SubscribeToMovements {
output: SubscribeToMovementsOutput
}

structure SubscribeToMovementsOutput {
movements: MovementEvents,
}

@streaming
union MovementEvents {
up: Movement,
down: Movement,
left: Movement,
right: Movement,
throttlingError: ThrottlingError
}

structure Movement {
velocity: Float,
}

/// An example error emitted when the client is throttled
/// and should terminate the event stream.
@error("client")
@retryable(throttling: true)
structure ThrottlingError {}

0 comments on commit 14d19d0

Please sign in to comment.