org.zodiac.sdk.async.promises.FailureHandler Maven / Gradle / Ivy
package org.zodiac.sdk.async.promises;
/**
* Handles the case that a Logic fails, either by throwing an exception
* or passing a throwable to its trigger's trigger()
method.
*
*/
public interface FailureHandler {
/**
* Called when something fails.
*
* @param The input type of the logic that failed
* @param key The key, if any
* @param input The input data at the time of failure
* @param context {@link PromiseContext}
* @param thrown The exception that was encountered
* @return {@code True} if the promise is a chained one, and earlier elements in
* the chain may also have failure handlers that should be notified
*/
boolean onFailure(PromiseContext.Key key, T input, Throwable thrown, PromiseContext context);
}