Skip to content

Instantly share code, notes, and snippets.

@polac24
Last active January 24, 2018 15:00
Show Gist options
  • Save polac24/6f168fef32f362e1bb7e6c7390dab50a to your computer and use it in GitHub Desktop.
Save polac24/6f168fef32f362e1bb7e6c7390dab50a to your computer and use it in GitHub Desktop.
let previousErrorHandler:ErrorHandleable = /// existing handler
// setup a handler
let errorHandler = previousErrorHandler.catch {error in
// Log all errors into console and pass it further
print(error)
throw error
}.catch {
// Stop propagation for all errors(no throwing)
}
...
errorHandler.throw(AppError.tokenExpired){
// finally block
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment