Search in sources :

Example 1 with UnsupportedCommandException

use of io.spine.server.commandbus.UnsupportedCommandException in project core-java by SpineEventEngine.

the class CommandService method handleUnsupported.

private static void handleUnsupported(Command request, StreamObserver<Response> responseObserver) {
    final CommandException unsupported = new UnsupportedCommandException(request);
    log().error("Unsupported command posted to CommandService", unsupported);
    responseObserver.onError(invalidArgumentWithCause(unsupported, unsupported.getError()));
}
Also used : UnsupportedCommandException(io.spine.server.commandbus.UnsupportedCommandException) UnsupportedCommandException(io.spine.server.commandbus.UnsupportedCommandException) CommandException(io.spine.server.commandbus.CommandException)

Example 2 with UnsupportedCommandException

use of io.spine.server.commandbus.UnsupportedCommandException in project core-java by SpineEventEngine.

the class CommandService method handleUnsupported.

private static void handleUnsupported(Command request, StreamObserver<Ack> responseObserver) {
    final UnsupportedCommandException unsupported = new UnsupportedCommandException(request);
    log().error("Unsupported command posted to CommandService", unsupported);
    final Error error = unsupported.asError();
    final Ack response = reject(request.getId(), error);
    responseObserver.onNext(response);
    responseObserver.onCompleted();
}
Also used : UnsupportedCommandException(io.spine.server.commandbus.UnsupportedCommandException) Ack(io.spine.core.Ack) Error(io.spine.base.Error)

Aggregations

UnsupportedCommandException (io.spine.server.commandbus.UnsupportedCommandException)2 Error (io.spine.base.Error)1 Ack (io.spine.core.Ack)1 CommandException (io.spine.server.commandbus.CommandException)1