On Wed, May 7, 2008 at 5:14 PM, Danek Duvall <[EMAIL PROTECTED]> wrote:
> On Wed, May 07, 2008 at 02:06:18PM -0500, Shawn Walker wrote:
>
>  > However, I did wonder what the effective difference is from what you've 
> done:
>  >
>  >       121 +        except Exception, e:
>  >       122 +                if isinstance(e, socket.error) and \
>  >       123 +                    e.args[0] == errno.EPIPE:
>  >
>  > and this found in module/server/face.py:
>  >                 except socket.error, e:
>  >                         if e[0] != EPIPE:
>  >                                 request.log_error("Failed to serve %s: %s" 
> % \
>  >                                     (request.path_info, e[1]))
>
>  It's roughly the same thing, except that the catalog call could end up with
>  a raft of exceptions being thrown, so it's casting a wider net, so we do
>  the separate isinstance() check.  I thought about letting it fall through
>  to the exception block in the dispatcher, but that would have resulted in a
>  500 being sent back (as the comment in catalog_0() says), which is the
>  problem we talked about Monday.  I'll be the first to admit we're probably
>  not extremely precise here in this, but I also figure that it's not worth
>  spending a whole lot of time getting this just so with the server rewrite
>  coming down the pike.
>
>  Or are you asking about e.args[0] vs e[0]?  That's just stylistic more than
>  anything else, I guess.  Exceptions are so un-uniform in the way they
>  contain useful data (if they contain any), it's hard to keep track of which
>  ones present it in which way.

Actually, I was subtly asking about both.

You've answered both of my questions quite thoroughly.

I was just trying to understand the difference in approach, and now I do.

Thanks,
-- 
Shawn Walker

"To err is human -- and to blame it on a computer is even more so." -
Robert Orben
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to