Hi John,

Thanks for making those changes. It looks good now.

- Keith

On 03/22/11 09:36 AM, John Fischer wrote:
Keith, et al,

Here is an updated webrev for this issue:

    http://cr.opensolaris.org/~johnfisc/7028358-aimdns-traceback.1/
    http://cr.opensolaris.org/~johnfisc/7028358-aimdns-traceback.diff-1/

The original webrev is located at:

    http://cr.opensolaris.org/~johnfisc/7028358-aimdns-traceback/

I've added the BonjourError exception into the aimdns and aimdnsd
tools and removed these exceptions from within aimdns_mod (i.e.,
changed it back to the original code).

Thanks,

John


On 03/18/11 11:36 AM, Keith Mitchell wrote:
On 03/17/11 11:24 AM, John Fischer wrote:
Keith,

aimdns and aimdnsd do not actually know about pybonjour (i.e., no import, no pybojour calls, ...). Thus I wanted to keep the pybonjour exception with the pybonjour code in aimdns_mod.py.
Does that make sense?

I understand the reasoning, but I disagree with it. I don't see a problem with importing to catch the pybonjour errors. Exceptions should be fine-grained enough that a caller can differentiate easily between errors it can handle and errors it can't. So for example, in _register_a_service, there's no easy way for a caller to differentiate between "Missing SMF property" errors and "PyBonjour" error.

A (grudgingly) acceptable alternative would be to raise a subclass of AIMDNSError for these situations, something like:

class MDNSDisabledError(AIMDNSError):
    ...

That at least allows room for expanding the other error cases to be more fine grained in the future.

I could also check to see if the dns/multicast service is enabled and exit nicely from aimdns and
aimdnsd when it is not.  Would that make more sense to you?

This seems like a case where it's better to try, and exit gracefully on failure, so the current approach is on the right track, I'd say.

Thanks,

John

On Mar 17, 2011, at 11:04 AM, Keith Mitchell wrote:

Hi John,

Is there a reason this approach is taken vs catching the pybonjour error from the aimdns/d? I don't see the advantage to adding so many try/except blocks. Propagating the pybonjour error would also allow callers to, if they so choose, differentiate their error handling based on the source of the error. As an example, one could catch pybonjour and print a message about the multicast service probably not being enabled (just an example, not necessarily suggesting it).

- Keith

On 03/17/11 10:51 AM, John Fischer wrote:
All,

Can I get a code review for CR:

    http://monaco.sfbay.sun.com/detail.jsf?cr=7028358

The webrev is located at:

http://cr.opensolaris.org/~johnfisc/7028358-aimdns-traceback/index.html

This issue is caused by the svc:/network/dns/multicast:default SMF service not being enabled. Thus when aimdns or aimdnsd are ran pybonjour raises an exception. The solution is to catch the exception within the aimdsn_mod module and raise AIMDNSError which is already caught by both aimdns and
aimdnsd.

Thanks,

John
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss



_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss

Reply via email to