Not sure what you mean, when xml_dump raises an exception, it is catched
here, xml is dumped when debug is enabled along with the error message
and the exception is being passed on.

Please write me example how you would expect this to be better. I am not
going to return whole XML file to the REST client, that's just too much
IMHO.

LZ

On Mon, Dec 09, 2013 at 02:29:33AM -0800, Dominic Cleal wrote:
> > +
> > +    # we support only one subnet
> > +    def loadSubnets
> > +      super
> > +      doc = REXML::Document.new xml = dump_xml
> > +      doc.elements.each("network/ip") do |e|
> > +        next if e.attributes["family"] == "ipv6"
> > +        netmask = e.attributes["netmask"]
> > +        gateway = e.attributes["address"]
> > +        network = IPAddr.new(gateway).mask(netmask).to_s
> > +        subnet = Proxy::DHCP::Subnet.new(self, network, netmask)
> > +        # TODO - where should I store subnet info? this is not working...
> > +        subnet.options["gateway"] = gateway
> > +      end
> > +    rescue Exception => e
> > +      logger.error "DNS virsh provider error: unable to parse virsh XML - #{e}"
> 
> This could catch exceptions thrown by `dump_xml` (e.g. when the command fails to execute), it should be more specific and wrap the XML parsing.
> 
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/theforeman/smart-proxy/pull/116/files#r8193034

-- 
Later,

 Lukas "lzap" Zapletal
 irc: lzap #theforeman