Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57486
| Date | 2013-10-24 20:17 -0500 |
|---|---|
| From | Andrew Berg <robotsondrugs@gmail.com> |
| Subject | Re: Re-raising a RuntimeError - good practice? |
| References | <670cb7a6-f8e9-4e3d-95a0-95728f8dd815@googlegroups.com> <mailman.1439.1382589791.18130.python-list@python.org> <c40fd572-d344-4d48-8c37-4fbbcc60efa3@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1493.1382663859.18130.python-list@python.org> (permalink) |
On 2013.10.24 20:09, Victor Hooi wrote: > Also, @Andrew Berg - you mentioned I'm just swallowing the original exception and re-raising a new RuntimeError - I'm guessing this is a bad practice, right? If I use just "raise" > > except Exception as err: # catch *everything* > logger.error(err) > raise > > that will just re-raise the original exception right? Yes. However, if you are doing logging higher up where you actually handle the exception, then logging here is redundant, and you can simply eliminate the try/catch block completely. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re-raising a RuntimeError - good practice? Victor Hooi <victorhooi@gmail.com> - 2013-10-23 20:23 -0700
Re: Re-raising a RuntimeError - good practice? Steven D'Aprano <steve@pearwood.info> - 2013-10-24 04:34 +0000
Re: Re-raising a RuntimeError - good practice? Andrew Berg <robotsondrugs@gmail.com> - 2013-10-23 23:42 -0500
Re: Re-raising a RuntimeError - good practice? Victor Hooi <victorhooi@gmail.com> - 2013-10-24 18:09 -0700
Re: Re-raising a RuntimeError - good practice? Andrew Berg <robotsondrugs@gmail.com> - 2013-10-24 20:17 -0500
Re: Re-raising a RuntimeError - good practice? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-25 02:30 +0000
Re: Re-raising a RuntimeError - good practice? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-25 00:44 -0700
csiph-web