Catch exception with message?

Random832 random832 at fastmail.com
Fri Jun 3 20:42:19 EDT 2016


On Fri, Jun 3, 2016, at 19:14, Piyush Verma 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.

The message is meant to be human-readable, and may change without
warning. Is there no other property on the exceptions you want to catch
that can be used to distinguish them? (errno, perhaps?) What's your
specific use case?



More information about the Python-list mailing list