On Thu, Aug 14, 2008 at 09:01:41AM -0700, Danek Duvall wrote: > On Thu, Aug 14, 2008 at 03:12:20PM +0800, Max Zhen wrote: > > > So, in this dlpi module for Python, I followed the requirement by > > calling PyErr_SetString(PyExc_OSError, err_code_from_libdlpi_interface) > > to raise the exception whenever dlpi interface returns an error. > > Wouldn't a specialized exception be more appropriate? That would allow > people to be more specific in their error handling, and not have to wrap > calls to the dlpi methods as tightly as a generic exception would force > them to. You could even inherit DLPIError (or whatever) from OSError, if > you like.
I don't get the benefit. We're returning OS errors (errno), and we have no additional information beyond errno/strerror. This would just obscure things IMHO. > We (the IPS team) have been finding that re-using the existing exception > hierarchy has been very limiting, and are switching over to specialized > exceptions. I believe you were using generic exceptions for pkg-internal exceptions though, which isn't the case here. (I might well be wrong about this). regards john