Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40379

Re: Dealing with exceptions

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'exception': 0.03; 'exception.': 0.07; 'fixed,': 0.09; 'terminate.': 0.09; 'thrown': 0.09; 'bug': 0.10; 'client,': 0.16; 'distinct': 0.16; 'expression)': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'top-level': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'instance,': 0.17; 'http': 0.22; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; "d'aprano": 0.29; 'steven': 0.29; 'code': 0.31; 'handle': 0.33; 'to:addr:python- list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'minimum': 0.34; 'server': 0.35; 'generic': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'next': 0.35; 'but': 0.36; 'anything': 0.36; 'subject:with': 0.36; '(for': 0.37; 'systems,': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'your': 0.60; "you'll": 0.62; 'back': 0.62; 'between': 0.63; 'details': 0.63; '2013': 0.84; 'effectively,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=3Zd6ME+sqd58DTGL/bYFxrTVBm/gJ98z81u/vS2blQQ=; b=my/3qnNccFDscWG/DkcxsTOKN4+PSZOtwxEerskcXx4BsgVVNoYe28kC54zW1sDPh4 dN12WwctPYPIV7Bp6hPxIvQNj2W+fFwEYWXI2kh7LxievvXTjUEsWEf/nYfqFo9cORfs vMQQIo6dZR3aQJl0JFps2TzqC1xgdmsM9mdLeh5WfdTHUoaYB8qEN6+fH6ml2mYvcUTd qBm0m9esOBeJ0WBNZHwh+Vh9SZLXXDrM+bY0+MBTbtJnv78z69O2Taf2j9uL+gY9STbd cW3TH4SmhzEOFtViEf0IReC1se18a0Ot7lf/Ejf/apmrdp/3WBfIQnVKvZyM+YZuBl9h aXaQ==
MIME-Version 1.0
X-Received by 10.220.218.195 with SMTP id hr3mr5792478vcb.70.1362272643097; Sat, 02 Mar 2013 17:04:03 -0800 (PST)
In-Reply-To <51329c25$0$30001$c3e8da3$5496439d@news.astraweb.com>
References <707df78f-9a67-4ce1-8dd3-095c75a7f7da@googlegroups.com> <mailman.2785.1362246769.2939.python-list@python.org> <51329c25$0$30001$c3e8da3$5496439d@news.astraweb.com>
Date Sun, 3 Mar 2013 12:04:02 +1100
Subject Re: Dealing with exceptions
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2805.1362272646.2939.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362272646 news.xs4all.nl 6962 [2001:888:2000:d::a6]:52543
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40379

Show key headers only | View raw


On Sun, Mar 3, 2013 at 11:41 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> But yes, in general, only catch the minimum you *know* you need to catch
> and can deal with. Anything else is a bug in your code that needs to be
> fixed, and you can't fix it if you never see the exception.

With the exception (if you'll excuse the expression) of "framework"
systems, where there's a distinct separation between "inside" and
"outside". Often then, the "outside" will catch any exception thrown
by the "inside" and deal with it in some generic way (for instance, a
web server might log the details and return HTTP 500 to the client,
then go back and handle the next request). Effectively, this is doing
the job of the top-level exception handler: log the exception (to the
console) and terminate.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 09:40 -0800
  Re: Dealing with exceptions Kwpolska <kwpolska@gmail.com> - 2013-03-02 18:52 +0100
    Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:35 -0800
      Re: Dealing with exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-03 01:41 +0000
    Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:35 -0800
    Re: Dealing with exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-03 00:41 +0000
      Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 12:04 +1100
    Re: Dealing with exceptions Nobody <nobody@nowhere.com> - 2013-03-03 23:01 +0000
  Re: Dealing with exceptions Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-02 10:58 -0700
  Re: Dealing with exceptions Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-02 11:00 -0700
  Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 05:21 +1100
    Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:39 -0800
    Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:39 -0800
  Re: Dealing with exceptions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-02 19:18 +0000
  Re: Dealing with exceptions Devin Jeanpierre <jeanpierreda@gmail.com> - 2013-03-02 14:27 -0500
  Re: Dealing with exceptions Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-02 11:43 -0800
  Re: Dealing with exceptions Terry Reedy <tjreedy@udel.edu> - 2013-03-02 16:23 -0500
  Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 09:16 +1100
  Re: Dealing with exceptions Terry Reedy <tjreedy@udel.edu> - 2013-03-02 18:08 -0500
  Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 10:17 +1100

csiph-web