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

[Nbd] About error management



Hi

Now that I've started to work on generalizing the dynamic
reconfiguration hack, I bumped into the quite complex or at least
unnecessarily complex error mangement scheme currently used in
nbd-server.c. There seems to be several different error reporting
styles: fprintf(), msgX(), g_warning(), perror(). Maybe we could try
to uniform this somehow?

But the real problem is, that in many places, error reporting and
handling is tightly coupled and buried inside utility functions. Uses
of err() or perror() followed by exit() are good examples. I do
realize that there probably hasn't been a real need for separating
reporting from handling earlier, but now there is. To exploit the
existing code base, error handling (i.e. the decisions to what to make
in case of an error) needs to be separeted from error reporting:
calling a function which might call exit() in the middle of a
reconfiguration process is obviously going to cause troubles sooner or
later.

My suggestion is that because we are already depending on libglib and
using it's error reporting framework in few places, we should try to
use the same mechanism everywhere. In other words, we should pass
GError** to functions requiring an error reporting mechanism and then
make the error handling decisions in the caller.

Thoughts?

Best regards,
-- 
Tuomas



Reply to: