Commit 33a4353e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Improve error reporting for the action edit_insert.

parent f8a457e0
......@@ -5,6 +5,7 @@
import traceback
from gluon import current
from gluon.restricted import RestrictedError
from harvest_tools import (format_author_fr,
family_name_fr,
build_harvester_tool,
......@@ -216,13 +217,17 @@ def edit_insert():
values['PublicationsSubmitted'] = ', '.join(record.submitted())
values['PublicationsYear'] = record.year()
except (CdsException, Marc12Exception, ToolException) as e:
return INLINE_ALERT % (T('Error'), T(str(e)))
except Exception:
except BaseException as e:
# for debug when web2py is in debug mode
print((traceback.format_exc()))
return INLINE_ALERT % (T('Error'), T(str(e)))
# log the exception in the web2py ticker system
ticket = RestrictedError(layer='harvester.py',
code='edit_insert',
output='',
environment=current.globalenv)
ticket.log(request)
# inform the user that something went wrong in the server
raise HTTP(500)
return dict(cfg=cfg, values=values)
......
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