Structures
The following structures are available globally.
-
An Error representing a failure within the CircuitBreaker call.
BreakerError is intended to be extended to describe command context errors.
Usage Example:
See moreextension BreakerError { public static let URLEncodingError = BreakerError(reason: "URL Could Not Be Found") public static let responseError = BreakerError(reason: "Invalid Response Error") } func myContextFunction(invocation: Invocation<(String), Void, String>) { guard let url = URL(string: "http://mysever.net/path/\(invocation.commandArgs)") else { invocation.notifyFailure(error: BreakerError.URLEncodingError) } URLSession.shared.dataTask(with: URLRequest(url: url)) { result, res, err in guard let result = result else { invocation.notifyFailure(error: BreakerError.responseError) return } invocation.notifySuccess() }.resume() }
Declaration
Swift
public struct BreakerError: Error