[Libguestfs] [PATCH 4/5] mltools: curl: turn Curl.run to raise exceptions

Richard W.M. Jones rjones at redhat.com
Wed Jan 16 14:38:32 UTC 2019


I can see where you're going with this, but it does make the Curl
module more error-prone.  You need to use an exception since there is
a long distance between where the Curl command fails and where you
want to handle the failure.

I would say that you should add a special variation of [Curl.run]
which raises an exception and leave the existing [Curl.run] alone.

Existing users won't be accidentally affected while virt-builder can
use the exception-raising variant where appropriate.

At the same time I would also change common/mltools/tools_utils.ml:
run_main_and_handle_errors so it knows about the new exception and can
print a suitable (internal?) error.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list