[openstack-dev] Exceptions being translated in projects
Flavio Percoco
flavio at redhat.com
Fri May 10 14:59:38 UTC 2013
Greetings,
According to our wiki page[0], exceptions shouldn't be translated - which I agree
with - but, there are many exceptions marked for translation throughout OpenStack.
I'd like to understand why there's such inconsistency and whether the
wiki or the code should be changed.
The Issue:
=========
Lets split exceptions in 2 groups:
1) The ones raised by OpenStack modules when some conditions are not met,
quotas exceeded, whatever. For Example:
# Nova: quota.py:286
if overs:
raise exception.OverQuota(overs=sorted(overs), quotas=quotas,
usages={})
2) The ones coming from * that were catched, reformatted and
re-raised.
I'd agree on translating #1 since they are exceptions that belong to the module
itself and, lets say, it has control over them - even though, there's a risk on
doing that - whereas for #2 it doesn't and at the time of
catching-and-(reraising|logging) anything could happen.
Find bellow some cases where #2 is happening.
Nova:
https://github.com/openstack/nova/blob/master/nova/exception.py#L133
Glance:
https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L157
Cinder:
https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/nexenta/volume.py#L274
Keystone, instead, doesn't translate exceptions (I couldn't find a case
in my quick look).
Proposal
========
That being said, in order to keep consistency throughout OpenStack in terms of
translations and within the same app wrt "exceptions being translated"
I want to propose removing translations from exceptions, completely. However,
there could be cases (HTTP Errors?) where translating exceptions could make
sense and should be fine, or not?
Thoughts? Feedback? Volunteers?
Hopefully, I'm not seeing this from the wrong side, if so, please
explain and I'll STFU
Cheers,
FF
[0] https://wiki.openstack.org/wiki/Translations#What_To_Translate
--
{ name: "Flavio Percoco",
gpg: "87112EC1",
internal: "8261386",
phone: "+390687502386",
irc: ["fpercoco", "flaper87"]}
More information about the OpenStack-dev
mailing list