Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5147 > unrolled thread
| Started by | Andrew Berg <bahamutzero8825@gmail.com> |
|---|---|
| First post | 2011-05-11 13:14 -0500 |
| Last post | 2011-05-11 13:14 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Proper way to handle errors in a module Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-11 13:14 -0500
| From | Andrew Berg <bahamutzero8825@gmail.com> |
|---|---|
| Date | 2011-05-11 13:14 -0500 |
| Subject | Re: Proper way to handle errors in a module |
| Message-ID | <mailman.1421.1305137685.9059.python-list@python.org> |
On 2011.05.11 12:57 PM, Patty wrote: > Hi Andrew - > > Sometimes you want an exception come up and then use that information to > take your > program in some direction. Right, but I'm wondering how I should handle errors in a module, where different people will want their programs to do different things when an error occurs in a function or method from my module (which is not necessarily because of a bug in my module - the calling script could send a bad parameter or some system configuration could prevent the function from doing something). On one hand, I could let almost all exceptions go unhandled and have the calling script handle them. This would force the developer of the calling script to learn all the exceptions that my module could raise (which could be really annoying if I have custom exceptions for problems that don't otherwise raise an exception). OTOH, I could handle all the exceptions and return None or some default value, but that would make it harder for the developer to make the script react appropriately.
Back to top | Article view | comp.lang.python
csiph-web