[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Ovirt-devel] [patch] Even Better Exceptions For ruby-libvirt bindings



Chris Lalancette wrote:
> Mohammed Morsi wrote:
>> Updated and attached. Good news is everything compiles fine and 
>> everything seems to work. Due to request, I did not add the libvirt 
>> exception structure to the ruby-libvirt exception object, rather the 
>> message field is copied over. For the next revision the code, domain, 
>> level, other message fields, and anything else anyone needs will also be 
>> included. Enjoy!

Actually, besides my previous points, let me ask a question.  Given the
following code snippet:

#!/usr/bin/ruby

require 'libvirt'

conn = Libvirt::open

conn = Libvirt::open('foo')

conn = Libvirt::open('qemu+tcp://foo.perf.redhat.com/system')

Currently, these three open calls snippets all fail with ArgumentError.  As I
understand your new code, these will all now end up with "e_ConnectionError",
with some string set showing what the error was.  However, that's still not
fine-grained enough; in the first case, it's a programming error, so I want to
strack trace the whole program.  In the second case, it's a user error (entering
the wrong connection string in the database), so I want to fail gracefully with
the error message.  In the third case, the user did everything right, but the
network or the box wasn't up, so I want to fail gracefully with the error message.

So, with the above example in mind, is there any way to get that sort of
fine-grained information?  The answer may be no, depending on what kind of
information you get out of libvirt, but if it is possible, that's a lot more useful.

Chris Lalancette



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]