Skip to content

Commit

Permalink
Added Bundle function to using multiple FailureHandlers together (#366)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Noble <[email protected]>
  • Loading branch information
AverageMarcus authored Nov 28, 2024
1 parent 0a86baf commit e77b25e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added a `Bundle` function to allow using multiple FailureHandlers together

## [1.30.2] - 2024-11-07

### Fixed
Expand Down
9 changes: 9 additions & 0 deletions pkg/failurehandler/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ func Wrap(fn func()) FailureHandler {
return ""
}
}

// Bundle allows multiple different FailureHandler functions to be used in a chain
func Bundle(failureHandlers ...FailureHandler) FailureHandler {
return Wrap(func() {
for _, fn := range failureHandlers {
fn.(func() string)()
}
})
}

0 comments on commit e77b25e

Please sign in to comment.