<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 10, 2013 at 8:59 AM, Flavio Percoco <span dir="ltr"><<a href="mailto:flavio@redhat.com" target="_blank">flavio@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Greetings,<br>
<br>
According to our wiki page[0], exceptions shouldn't be translated - which I agree<br>
with - but, there are many exceptions marked for translation throughout OpenStack.<br>
<br>
I'd like to understand why there's such inconsistency and whether the<br>
wiki or the code should be changed.<br>
<br>
The Issue:<br>
=========<br>
<br>
Lets split exceptions in 2 groups:<br>
<br>
1) The ones raised by OpenStack modules when some conditions are not met,<br>
quotas exceeded, whatever. For Example:<br>
# Nova: quota.py:286<br>
if overs:<br>
raise exception.OverQuota(overs=<u></u>sorted(overs), quotas=quotas,<br>
usages={})<br>
<br>
2) The ones coming from * that were catched, reformatted and<br>
re-raised.<br>
<br></blockquote><div>I viewed this a bit differently, perhaps incorrectly... But my logic in the past has been don't do the translation in the raise, however if we're adding a LOG output message along with the exception (whether it's in a catch or otherwise) it seemed that the translation should be there.<br>
<br><br></div><div>That being said, it seems we do have a bit of a mix even in just case 1 (the actual raise itself). My thought is that the raise should not have the translation but that any additional LOG call associated with it should. <br>
</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'd agree on translating #1 since they are exceptions that belong to the module<br>
itself and, lets say, it has control over them - even though, there's a risk on<br>
doing that - whereas for #2 it doesn't and at the time of<br>
catching-and-(reraising|<u></u>logging) anything could happen.<br>
<br>
Find bellow some cases where #2 is happening.<br>
<br>
Nova:<br>
<a href="https://github.com/openstack/nova/blob/master/nova/exception.py#L133" target="_blank">https://github.com/openstack/<u></u>nova/blob/master/nova/<u></u>exception.py#L133</a><br>
<br>
Glance:<br>
<a href="https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L157" target="_blank">https://github.com/openstack/<u></u>glance/blob/master/glance/db/<u></u>sqlalchemy/api.py#L157</a><br>
<br>
Cinder:<br>
<a href="https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/nexenta/volume.py#L274" target="_blank">https://github.com/openstack/<u></u>cinder/blob/master/cinder/<u></u>volume/drivers/nexenta/volume.<u></u>py#L274</a><br>
<br>
<br>
Keystone, instead, doesn't translate exceptions (I couldn't find a case<br>
in my quick look).<br>
<br>
Proposal<br>
========<br>
<br>
That being said, in order to keep consistency throughout OpenStack in terms of<br>
translations and within the same app wrt "exceptions being translated"<br>
I want to propose removing translations from exceptions, completely. However,<br>
there could be cases (HTTP Errors?) where translating exceptions could make<br>
sense and should be fine, or not?<br>
<br>
Thoughts? Feedback? Volunteers?<br>
<br>
Hopefully, I'm not seeing this from the wrong side, if so, please<br>
explain and I'll STFU <br>
Cheers,<br>
FF<br>
<br>
<br>
[0] <a href="https://wiki.openstack.org/wiki/Translations#What_To_Translate" target="_blank">https://wiki.openstack.org/<u></u>wiki/Translations#What_To_<u></u>Translate</a><span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
{ name: "Flavio Percoco",<br>
gpg: "87112EC1", internal: "8261386",<br>
phone: "<a href="tel:%2B390687502386" value="+390687502386" target="_blank">+390687502386</a>",<br>
irc: ["fpercoco", "flaper87"]}<br>
<br>
______________________________<u></u>_________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.<u></u>org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/<u></u>cgi-bin/mailman/listinfo/<u></u>openstack-dev</a><br>
</font></span></blockquote></div><br></div></div>