Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109448 > unrolled thread
| Started by | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| First post | 2016-06-04 10:48 +1000 |
| Last post | 2016-06-04 10:48 +1000 |
| 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: Catch exception with message? Ben Finney <ben+python@benfinney.id.au> - 2016-06-04 10:48 +1000
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2016-06-04 10:48 +1000 |
| Subject | Re: Catch exception with message? |
| Message-ID | <mailman.142.1465001407.1839.python-list@python.org> |
Piyush Verma <114piyush@gmail.com> writes: > But sometimes, we see same type of exception is present with different > message.Is there a way to capture same exception with message > filtering? Please help me to do this. That's a nasty code smell. Why would you want your code to behave differently depending on what the text of the message is? The message should not change the semantic meaning of the exception type. If there are exceptions that *mean* different things (i.e. that require different handling), they should be different types. See the Python 3 standard exception hierarchy for a good example. -- \ “The greatest tragedy in mankind's entire history may be the | `\ hijacking of morality by religion.” —Arthur C. Clarke, 1991 | _o__) | Ben Finney
Back to top | Article view | comp.lang.python
csiph-web