Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109445 > unrolled thread

Re: Catch exception with message?

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2016-06-03 18:25 -0600
Last post2016-06-03 18:25 -0600
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.


Contents

  Re: Catch exception with message? Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-03 18:25 -0600

#109445 — Re: Catch exception with message?

FromIan Kelly <ian.g.kelly@gmail.com>
Date2016-06-03 18:25 -0600
SubjectRe: Catch exception with message?
Message-ID<mailman.139.1464999965.1839.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web