@@ -256,36 +256,30 @@ public enum PollingStopCondition: Sendable, Equatable {
256256}
257257```
258258
259- ### New ` PollingFailureReason ` enum
260-
261- There are 2 reasons why polling confirmations can fail: the stop condition
262- failed, or the confirmation was cancelled during the run. To help express this,
263- we will be adding a new ` PollingFailureReason ` enum.
264-
265- ``` swift
266- /// A type describing why polling failed
267- public enum PollingFailureReason : Sendable , Codable {
268- /// The polling failed because it was cancelled using `Task.cancel`.
269- case cancelled
270-
271- /// The polling failed because the stop condition failed.
272- case stopConditionFailed (PollingStopCondition)
273- }
274- ```
275-
276- ### New Error Type
259+ ### New ` PollingFailedError ` Error Type and ` PollingFailedError.Reason ` enum
277260
278261A new error type, ` PollingFailedError ` to be thrown when the polling
279- confirmation doesn't pass:
262+ confirmation doesn't pass. This contains a nested enum expressing the 2 reasons
263+ why polling confirmations can fail: the stop condition failed, or the
264+ confirmation was cancelled during the run:
280265
281266``` swift
282267/// A type describing an error thrown when polling fails.
283268public struct PollingFailedError : Error , Sendable {
269+ /// A type describing why polling failed
270+ public enum Reason : Sendable , Codable {
271+ /// The polling failed because it was cancelled using `Task.cancel`.
272+ case cancelled
273+
274+ /// The polling failed because the stop condition failed.
275+ case stopConditionFailed (PollingStopCondition)
276+ }
277+
284278 /// A user-specified comment describing this confirmation
285279 public var comment: Comment? { get }
286280
287281 /// Why polling failed, either cancelled, or because the stop condition failed.
288- public var reason: PollingFailureReason { get }
282+ public var reason: Reason { get }
289283}
290284```
291285
0 commit comments