Remove `throw error as! Failure` TaskLocal adopts typed throws
- Dominant language
- Swift
- Stars
- 4k
- Forks
- 344
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 4
Description
Swift issue https://github.com/swiftlang/swift/issues/75520
The code in question:
```
public func withLogger(
_ logger: Logger,
_ operation: (Logger) throws(Failure) -> Result
) throws(Failure) -> Result {
do {
return try Logger.withTaskLocalLogger(logger) {
try operation(logger)
}
} catch {
throw error as! Failure
}
}
```
Contributor guide
Research direction
Start with the withLogger implementation shown in the issue and read Swift issue 75520 for the TaskLocal typed-throws behavior. Run the project's existing tests after removing the unnecessary forced cast; done means the code compiles and the operation preserves its declared Failure type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- observability-sre
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100