Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109445
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Catch exception with message? |
| Date | 2016-06-03 18:25 -0600 |
| Message-ID | <mailman.139.1464999965.1839.python-list@python.org> (permalink) |
| References | <CAJV9OM_eDYJHsq1J7N9mYQEyqRsUR1S7LOJWZ8+XGEJ_h3CHYw@mail.gmail.com> <CALwzidnkqM72Zoyn_Rv5tBOEHrRPtT8vBGHqjNKveVkoPmgajg@mail.gmail.com> |
try:
something
except Exception as e:
if e.args[0] == message_of_interest:
handle_it
else:
raise
On Fri, Jun 3, 2016 at 5:14 PM, Piyush Verma <114piyush@gmail.com> wrote:
> Generally we catch exception using
> except Exception as e:
>
> 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.
>
> Regards,
> ~Piyush
> --
> https://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Catch exception with message? Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-03 18:25 -0600
csiph-web