Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5257
| Date | 2011-05-12 16:20 -0400 |
|---|---|
| From | Corey Richardson <kb1pkl@aim.com> |
| Subject | Re: Proper way to handle errors in a module |
| References | <mailman.1415.1305134998.9059.python-list@python.org> <roy-FB35E1.14050911052011@news.panix.com> <4DCC318E.7020809@gmail.com> <4DCC3421.9070007@mrabarnett.plus.com> <4DCC3F37.3010904@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1491.1305231953.9059.python-list@python.org> (permalink) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 05/12/2011 04:12 PM, Andrew Berg wrote:
> On 2011.05.12 02:25 PM, MRAB wrote:
>> You can raise an exception wherever you like! :-)
> If I raise an exception that isn't a built-in exception, I get something
> like "NameError: name 'HelloError' is not defined". I don't know how to
> define the exception.
class HelloError(Exception):
pass
Of course, there are all sorts of other things you could do with your
exception.
http://docs.python.org/tutorial/errors.html#user-defined-exceptions
- --
Corey Richardson
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNzED9AAoJEAFAbo/KNFvp1uQIAKFaKyD1Q3RL7LGFSmnyRFTK
9XWRH3CSM9mOALccfQ8bUkrquol1fAqhrm4jyOW0scWmsJpRlcb6Rj4HtrmMQOuG
DpsUzEZCTnT9Xk80OeTFbpWWBIVBkxdhCxCl75XAP22o5EjhHpgLyqoqMD+81BKH
5/JWAGRJx/9E4BvNWsxIUhb1jlz+XT4H1XykTE1UUOP0uZneWRJMs7P12WNiL2Ii
HT0hEUhQc1eP1fJ5BqPB/6/B9q/KxTbN55hCq1VwwfRhgbaM4kR7Bekri7QUHGAK
1MKxRa1v+Co59y+ywAIH92L3wky3xNyFrUlFzK4AwYOnwRkVvUWw7vPG1iShE+k=
=2+y6
-----END PGP SIGNATURE-----
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Proper way to handle errors in a module Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-11 12:29 -0500
Re: Proper way to handle errors in a module Roy Smith <roy@panix.com> - 2011-05-11 14:05 -0400
Re: Proper way to handle errors in a module Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-12 14:14 -0500
Re: Proper way to handle errors in a module MRAB <python@mrabarnett.plus.com> - 2011-05-12 20:25 +0100
Re: Proper way to handle errors in a module Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-12 15:12 -0500
Re: Proper way to handle errors in a module Corey Richardson <kb1pkl@aim.com> - 2011-05-12 16:20 -0400
Re: Proper way to handle errors in a module Tycho Andersen <tycho@tycho.ws> - 2011-05-12 15:26 -0500
Re: Proper way to handle errors in a module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-13 00:43 +0000
Re: Proper way to handle errors in a module MRAB <python@mrabarnett.plus.com> - 2011-05-12 21:26 +0100
Re: Proper way to handle errors in a module Ethan Furman <ethan@stoneleaf.us> - 2011-05-12 13:40 -0700
Re: Proper way to handle errors in a module Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-12 15:35 -0500
Re: Proper way to handle errors in a module Ben Finney <ben+python@benfinney.id.au> - 2011-05-13 10:56 +1000
csiph-web