code: private void handleRequestFailure(long requestId, Throwable error, ThreadContext context) {
      ByteBuf buffer = channel.alloc().buffer(10)
        .writeByte(RESPONSE)
        .writeLong(requestId)
        .writeByte(FAILURE);
  
      try {
        writeError(buffer, error, context);
      } catch (SerializationException e) {
        return;
      }
  
      channel.writeAndFlush(buffer, channel.voidPromise());
    }
docs: Handles a request failure.