Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for not throwing functions #1

Open
DanielZanchi opened this issue Jan 19, 2025 · 1 comment
Open

Support for not throwing functions #1

DanielZanchi opened this issue Jan 19, 2025 · 1 comment

Comments

@DanielZanchi
Copy link

Now it supports only functions that are throwing errors.
What about supporting function without try

@swhitty
Copy link
Owner

swhitty commented Jan 19, 2025

While the body closure () async throws -> T is throwing, it does support a closure that is not throwing like so;

let val = try await withThrowingTimeout(seconds: 2.0) {
   await perform()
}

withThrowingTimeout always throws because TimeoutError is always thrown when the deadline expires.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants