# withCheckedThrowingContinuation and typed Errors

**URL:** <https://forums.swift.org/t/withcheckedthrowingcontinuation-and-typed-errors/72502>\
**Category:** Using Swift\
**Tags:** asyncawait, continuation, typed-throws\
**Created:** [June 15, 2024, 9:29am UTC](https://forums.swift.org/t/withcheckedthrowingcontinuation-and-typed-errors/72502 "2024-06-15T09:29:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Quedlinbug](https://avatars.discourse-cdn.com/v4/letter/q/77aa72/32.png) [@Quedlinbug](https://forums.swift.org/u/Quedlinbug)\
**Post date:** [June 15, 2024, 2:11pm UTC](https://forums.swift.org/t/withcheckedthrowingcontinuation-and-typed-errors/72502/2 "2024-06-15T14:11:48Z")

</div>

First, read [Where is FullTypedThrows? - #15 by hborla](https://forums.swift.org/t/where-is-fulltypedthrows/72346/15).

* * *

You can't actually create a `Continuation` of any kind, with anything but `Never` or `any Error`. This has not changed with Xcode 16 Beta 1. However, you can at least mask this outside of the `Model` type, either with [an overload](https://forums.swift.org/t/using-actor-inheritance-typed-throws-and-continuations/71760/4), a `do-catch` statement, or a function that can apply that statement.

```swift
func doOperation() async throws(OperationFailed) {
  try await forceError(OperationFailed.self) {
    try await withCheckedThrowingContinuation { continuation in
      operationContinuation = continuation
    }
  }
}

```

```swift
func forceError<Success, Error: Swift.Error>(
  _: Error.Type,
  _ body: () async throws -> Success
) async throws(Error) -> Success {
  do {
    return try await body()
  } catch {
    throw error as! Error
  }
}

```

---

_[View the full topic](https://forums.swift.org/t/withcheckedthrowingcontinuation-and-typed-errors/72502)._
