summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2019-06-11 12:26:55 +0000
committerfja-odoo <fja@odoo.com>2019-06-28 08:53:53 +0000
commit0d1407a715901ea06e9a7211c0e3dbe09fadb785 (patch)
treed7d3a6cf49a358298b8caa2da8cd025be017c309 /addons/web/controllers/main.py
parent90818fd083774988c331d741d34181a5af5ecd3a (diff)
[IMP] base, web, *: make KarmaError an except_orm
* = gamification, test_website, stock - KarmaError is now handled as a 400 exception. - test_website has been updated. - NO_POSTMORTEM is now clean it was referencing duplicates as most the exceptions inherit from except_orm. - serialize_exception from http.py has been moved to ir_http to take advantage of the odoo inheritance system. We can then extend ir_http serialize_exception method to add the KarmaError logic if and only if gamification is installed. Places where serialize_exception was previously used are updated. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
Diffstat (limited to 'addons/web/controllers/main.py')
-rw-r--r--addons/web/controllers/main.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 860cf454dd4..7aca92712a8 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -42,8 +42,7 @@ from odoo.tools.translate import _
from odoo.tools.misc import str2bool, xlwt, file_open
from odoo.tools.safe_eval import safe_eval
from odoo import http, tools
-from odoo.http import content_disposition, dispatch_rpc, request, \
- serialize_exception as _serialize_exception, Response
+from odoo.http import content_disposition, dispatch_rpc, request, Response
from odoo.exceptions import AccessError, UserError, AccessDenied
from odoo.models import check_method_name
from odoo.service import db, security
@@ -83,7 +82,7 @@ def serialize_exception(f):
return f(*args, **kwargs)
except Exception as e:
_logger.exception("An exception occured during an http request")
- se = _serialize_exception(e)
+ se = request.registry['ir.http'].serialize_exception(e)
error = {
'code': 200,
'message': "Odoo Server Error",
@@ -1694,7 +1693,7 @@ class ReportController(http.Controller):
else:
return
except Exception as e:
- se = _serialize_exception(e)
+ se = request.env['ir.http'].serialize_exception(e)
error = {
'code': 200,
'message': "Odoo Server Error",