[bind10-dev] Exceptions - nested vs on top of header

Michal 'vorner' Vaner michal.vaner at nic.cz
Mon Dec 27 21:02:00 UTC 2010


Hello

(Sorry jinmey, resending to ML)

On Mon, Dec 27, 2010 at 12:14:20PM -0800, JINMEI Tatuya / 神明達哉 wrote:
> Based on this observation, what I'd prefer is to define (zero or) one
> common exception class for each non exception class (e.g. dns::Name).
> Then there should normally be no conflict among exceptions under the
> same namespace (because the class names are unique).  Exception
> classes in different namespaces can be distinguished by their
> namespaces.  If we want to provide more detailed exception classes for
> a particular (non exception) class, we'd introduce derived exception
> classes from the base exception class.
> 
> Example:
> namespace isc {
> namespace dns {
>  for class Name: exception class NameError
>    NameError.what() can be "incomplete name", "empty label", "too long
>    name", etc
>  for class RRType: exception class RRTypeError
>  for class Message: exception class MessageError
>  ...
>  for class Foo: exception class FooError
>                    derived classes of FooError: SpecificFooError1,
>                                                 SpecificFooError2, ...
> }
> }
> 
> We might also want to have a library-level base exception class, such
> as DNSException, DataSrcException, etc.  Then NameError,
> RRTypeError,... will be a derived class of DNSException.

Hmm, and if there would be need to more exception from one class? It could be
that we could have a class Name, it would have exception Name::Exception
(deriving from isc::dns::Exception) and, derived from that, Name::EmptyLabel.
That way, anyone not interested could catch Name::Exception or
isc::dns::Exception, but those interested could catch Name::EmptyLabel?

> Anyway, I don't think these are blocking issue for #447, and the
> ticket can move forward if and while we continue this discussion here.

So, as this is probably the only thing that is rest, do you think I should
continue and merge it?

Thank you

-- 
When eating an elephant take one bite at a time.
		-- Gen. C. Abrams

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20101227/5078c4f6/attachment.bin>


More information about the bind10-dev mailing list