John Levon writes:
> On Thu, Aug 14, 2008 at 09:01:41AM -0700, Danek Duvall wrote:
> > 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.

You do have additional information: the additional information you
have is that the error came from libdlpi, not just the OS itself.

That might not matter too much for anything that calls your methods
directly and that always includes its own exception handling, but it
matters quite a lot for anything that calls a wrapper method that in
turn calls your methods.

Using generic exceptions potentially causes the source of the problem
to get laundered away.

-- 
James Carlson, Solaris Networking              <james.d.carlson at sun.com>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677

Reply via email to