Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnSundell/4f12e289298e48b2a0fdcee17188256f to your computer and use it in GitHub Desktop.
Save JohnSundell/4f12e289298e48b2a0fdcee17188256f to your computer and use it in GitHub Desktop.
func perform<T>(_ expression: @autoclosure () throws -> T,
orThrow error: Error) throws -> T {
do {
return try expression()
} catch {
throw error
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment