git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Catch exception with message?


On Sat, 4 Jun 2016 04:44:30 +0530, Piyush Verma <114piyush at 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.

Just to make sure, . . . are you aware that "except Exception" is
generally not what you want to do, that you generally want to say
"except ValueError" or "except KeyError" or "except UnicdeDecodeError"
or something specific like that?  Maybe that's where to find the
specificity you seek.

-- 
To email me, substitute nowhere->runbox, invalid->com.