code: private ByteBuf writeError(ByteBuf buffer, Throwable t, ThreadContext context) {
      context.serializer().writeObject(t, OUTPUT.get().setByteBuf(buffer));
      return buffer;
    }
docs: Writes an error to the given buffer.