Commit a77bd652 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

erp5_api_style: jIOWebSection jio calls catch NotFound Errors

parent 72fea9df
......@@ -30,6 +30,7 @@
from AccessControl import ClassSecurityInfo
from AccessControl import Unauthorized
from Acquisition import aq_inner
from OFS.Traversable import NotFound
from erp5.component.document.WebSection import WebSection
from Products.ERP5Type import Permissions
from zLOG import LOG, INFO
......@@ -47,13 +48,21 @@ def convertTojIOAPICall(function):
try:
retval = function(self, *args, **kwd)
except Unauthorized, e:
LOG('SlapTool', INFO, 'Converting Unauthorized to Unauthorized error mesage in JSON,',
LOG('jIOWebSection', INFO, 'Converting Unauthorized to Unauthorized error mesage in JSON,',
error=True)
return self.ERP5Site_logApiErrorAndReturn(
error_code="403",
error_message=str(e),
error_name="Unauthorized"
)
except NotFound, e:
LOG('jIOWebSection', INFO, 'Converting NotFound to NotFound error mesage in JSON,',
error=True)
return self.ERP5Site_logApiErrorAndReturn(
error_code="404",
error_message=str(e),
error_name="NotFound"
)
return '%s' % retval
wrapper.__doc__ = function.__doc__
......
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