Java Code Examples for io.vlingo.common.Completes#withFailure()

The following examples show how to use io.vlingo.common.Completes#withFailure() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RequestObjectExecutor.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
static <O> Completes<Response> executeRequest(final Request request,
                                          final MediaTypeMapper mediaTypeMapper,
                                          final Supplier<Completes<ObjectResponse<O>>> executeAction,
                                          final ErrorHandler errorHandler,
                                          final Logger logger) {

  try {
    return executeAction.get()
      .andFinally(objectResponse -> toResponse(objectResponse, request, mediaTypeMapper, errorHandler, logger));
  } catch(Exception ex) {
    return Completes.withFailure( ResourceErrorProcessor.resourceHandlerError(errorHandler, logger, ex));
  }
}
 
Example 2
Source File: FailResource.java    From vlingo-http with Mozilla Public License 2.0 4 votes vote down vote up
public Completes<Response> query() {
  System.out.println("QUERY");
  return Completes.withFailure(Response.of(Status.BadRequest));
}