On Sunday, June 5, 2016 at 4:44:17 AM UTC+12, Peter Pearson wrote:
> ... are you aware that "except Exception" is generally not what you want to
> do ...
Agree. Always make your “except”-matching as specific as possible.
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 4 Jun 2016 04:44:30 +0530, Piyush Verma <114piy...@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
Below is exception type and it is user defined exception. I do not see
error number in exception stack. What other option we can use as
filter in below exception apart from message?
UserDefinedException: User defined message: {}
#012 File "/opt/cio/lib/python2.7/site-packages/manager.py", line
On Sat, 4 Jun 2016 09:14 am, 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.
That suggests that whoever wrote the code doesn't know what they're doing.
Intentionally giving
On 04Jun2016 04:44, Piyush Verma <114piy...@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.
Piyush Verma <114piy...@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
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
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 <114piy...@gmail.com> wrote:
> Generally we catch exception using
> except Exception as e:
>
> But sometimes, we see same type
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
--