class FailedPublisherStageFactory implements PublisherStageFactory<Stage.Failed> {

    @Override
    public <O> PublisherStage<O> create(Engine engine, Stage.Failed stage) {
        Throwable error = Objects.requireNonNull(Objects.requireNonNull(stage).getError());
        return () -> Flowable.error(error);
    }

}