<div dir="ltr"><div>> <span style="font-family:arial,sans-serif;font-size:13px">unicode(exc) (or six.text_type(exc)) works for all exceptions, built-in </span><span style="font-family:arial,sans-serif;font-size:13px">or custom.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div>That's too much of a statement. Sometimes exceptions implement their own __str__ / __unitcode__</div><div>methods, that return too many rubbish information or not enough. What do you do in that case?</div>
<div><br></div><div>BTW, I don't say that we have to skip `six.text_type(exc)` approach. I'm just saying, that it's not</div><div>a panacea in real world.</div><div><br></div><div>> <span style="font-family:arial,sans-serif;font-size:13px">six.text_type(exc) is the recommended solution</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><font face="arial, sans-serif">As I mention in first letter, I vote for this solution since it's a general case.</font><br></div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 16, 2014 at 4:03 PM, Johannes Erdfelt <span dir="ltr"><<a href="mailto:johannes@erdfelt.com" target="_blank">johannes@erdfelt.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Fri, May 16, 2014, Igor Kalnitsky <<a href="mailto:ikalnitsky@mirantis.com">ikalnitsky@mirantis.com</a>> wrote:<br>
> > According to <a href="http://legacy.python.org/dev/peps/pep-0352/" target="_blank">http://legacy.python.org/dev/peps/pep-0352/</a> the message<br>
> > attribute of BaseException is deprecated since Python 2.6 and was<br>
> > dropped in Python 3.0.<br>
><br>
> Some projects have custom exception hierarchy, with strictly defined<br>
> attributes (e.g. message, or something else). In a previous mail, I<br>
> mean exactly that case, not the case with a built-in exceptions.<br>
<br>
</div>That's a fragile assumption to make.<br>
<br>
unicode(exc) (or six.text_type(exc)) works for all exceptions, built-in<br>
or custom. I don't see the reason why it's being avoided.<br>
<span class="HOEnZb"><font color="#888888"><br>
JE<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br></div>