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

Add withErrorReporting #143

Merged
merged 7 commits into from
Jan 29, 2025
Merged

Add withErrorReporting #143

merged 7 commits into from
Jan 29, 2025

Conversation

stephencelis
Copy link
Member

It's common to write the following boilerplate when working with code that can throw errors:

do {
  try work()
} catch {
  reportIssue(error)
}

Let's extract this pattern to a helper that can save at least some boilerplate:

withErrorReporting {
  try work()
}

Or even make it a 1-liner in some cases:

withErrorReporting(catching: work)

It's common to write the following boilerplate when working with code
that can throw errors:

```swift
do {
  try work()
} catch {
  reportIssue(error)
}
```

Let's extract this pattern to a helper that can save at least some
boilerplate:

```swift
withErrorReporting {
  try work()
}
```

Or even make it a 1-liner in some cases:

```swift
withErrorReporting(catching: work)
```
@stephencelis stephencelis merged commit adadb00 into main Jan 29, 2025
15 checks passed
@stephencelis stephencelis deleted the with-error-reporting branch January 29, 2025 22:21
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

Successfully merging this pull request may close these issues.

2 participants