Commit b6ea4f65 authored by Tatuya Kamada's avatar Tatuya Kamada

Raise meaningful error message instead of index error.

parent 02b0b49f
...@@ -1134,4 +1134,11 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin): ...@@ -1134,4 +1134,11 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
query = self.ResourceModule_zGetQuantityUnitDefinitionRatio( query = self.ResourceModule_zGetQuantityUnitDefinitionRatio(
quantity_unit_uid=quantity_unit_uid, quantity_unit_uid=quantity_unit_uid,
resource_uid=self.getUid()) resource_uid=self.getUid())
try:
return query[0].quantity return query[0].quantity
except:
raise LookupError('Can not find the Quantity Unit Conversion '\
'Definition. Please make sure that Unit '\
'Conversion Definitions are indexed.'\
'quantity_unit_uid: %s, resource_uid: %s' \
% (quantity_unit_uid, self.getUid()))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment