Search in sources :

Example 1 with ServerErrorException

use of tech.pegasys.teku.networking.eth2.rpc.core.RpcException.ServerErrorException in project teku by ConsenSys.

the class Eth2OutgoingRequestHandlerTest method deliverError.

private void deliverError() {
    final Bytes errorChunk = responseEncoder.encodeErrorResponse(new ServerErrorException());
    deliverBytes(errorChunk);
}
Also used : Bytes(org.apache.tuweni.bytes.Bytes) ServerErrorException(tech.pegasys.teku.networking.eth2.rpc.core.RpcException.ServerErrorException)

Example 2 with ServerErrorException

use of tech.pegasys.teku.networking.eth2.rpc.core.RpcException.ServerErrorException in project teku by ConsenSys.

the class RpcResponseCallback method completeWithUnexpectedError.

@Override
public void completeWithUnexpectedError(final Throwable error) {
    if (error instanceof PeerDisconnectedException) {
        LOG.trace("Not sending RPC response as peer has already disconnected");
        // But close the stream just to be completely sure we don't leak any resources.
        rpcStream.closeAbruptly().reportExceptions();
    } else {
        completeWithErrorResponse(new ServerErrorException());
    }
}
Also used : ServerErrorException(tech.pegasys.teku.networking.eth2.rpc.core.RpcException.ServerErrorException) PeerDisconnectedException(tech.pegasys.teku.networking.p2p.peer.PeerDisconnectedException)

Aggregations

ServerErrorException (tech.pegasys.teku.networking.eth2.rpc.core.RpcException.ServerErrorException)2 Bytes (org.apache.tuweni.bytes.Bytes)1 PeerDisconnectedException (tech.pegasys.teku.networking.p2p.peer.PeerDisconnectedException)1