Catch only RPCException on RPCExecute without exception processing
This commit is contained in:
@@ -1001,10 +1001,13 @@ def process_exception(exception, *args, **kwargs):
|
||||
name, msg, description = exception.args
|
||||
res = userwarning(description, msg)
|
||||
if res in ('always', 'ok'):
|
||||
RPCExecute(
|
||||
'model', 'res.user.warning', 'skip',
|
||||
name, (res == 'always'),
|
||||
process_exception=False)
|
||||
try:
|
||||
RPCExecute(
|
||||
'model', 'res.user.warning', 'skip',
|
||||
name, (res == 'always'),
|
||||
process_exception=False)
|
||||
except RPCException:
|
||||
pass
|
||||
return rpc_execute(*args)
|
||||
elif exception.faultCode == 'UserError':
|
||||
msg, description, domain = exception.args
|
||||
|
||||
@@ -5,7 +5,7 @@ import logging
|
||||
|
||||
from gi.repository import GLib, Gtk
|
||||
|
||||
from tryton.common import RPCExecute
|
||||
from tryton.common import RPCException, RPCExecute
|
||||
from tryton.config import CONFIG
|
||||
from tryton.exceptions import TrytonError, TrytonServerError
|
||||
|
||||
@@ -72,7 +72,7 @@ def update_completion(entry, record, field, model, domain=None):
|
||||
'model', model, 'autocomplete', search_text, domain,
|
||||
CONFIG['client.limit'], order, context=context,
|
||||
process_exception=False, callback=callback)
|
||||
except Exception:
|
||||
except RPCException:
|
||||
logger.warning(
|
||||
"Unable to search for completion of %s", model,
|
||||
exc_info=True)
|
||||
|
||||
@@ -20,7 +20,7 @@ def renew():
|
||||
def set_cookie(new_cookie):
|
||||
try:
|
||||
new_cookie = new_cookie()
|
||||
except Exception:
|
||||
except common.RPCException:
|
||||
logger.error("Cannot renew device cookie", exc_info=True)
|
||||
else:
|
||||
_set(new_cookie)
|
||||
|
||||
@@ -23,8 +23,7 @@ from tryton.common import RPCContextReload, RPCException, RPCExecute
|
||||
from tryton.common.cellrendererclickablepixbuf import (
|
||||
CellRendererClickablePixbuf)
|
||||
from tryton.config import CONFIG, TRYTON_ICON, get_config_dir
|
||||
from tryton.exceptions import (
|
||||
TrytonError, TrytonServerError, TrytonServerUnavailable)
|
||||
from tryton.exceptions import TrytonError, TrytonServerUnavailable
|
||||
from tryton.gui.window import Window
|
||||
from tryton.jsonrpc import object_hook
|
||||
from tryton.pyson import PYSONDecoder
|
||||
@@ -376,7 +375,7 @@ class Main(Gtk.Application):
|
||||
def set_result(result):
|
||||
try:
|
||||
result = result()
|
||||
except (RPCException, TrytonServerError):
|
||||
except RPCException:
|
||||
result = []
|
||||
if search_text != widget.get_text():
|
||||
if callback:
|
||||
@@ -472,7 +471,7 @@ class Main(Gtk.Application):
|
||||
favorites = RPCExecute('model',
|
||||
self.menu_screen.model_name + '.favorite', 'get',
|
||||
process_exception=False)
|
||||
except Exception:
|
||||
except RPCException:
|
||||
return False
|
||||
for id_, name, icon in favorites:
|
||||
menuitem = Gtk.MenuItem(label=name)
|
||||
|
||||
@@ -74,7 +74,7 @@ class EmailEntry(Gtk.Entry):
|
||||
RPCExecute(
|
||||
'model', 'ir.email', 'complete', text, CONFIG['client.limit'],
|
||||
process_exception=False, callback=callback)
|
||||
except Exception:
|
||||
except RPCException:
|
||||
logger.warning(
|
||||
_("Unable to complete email entry"), exc_info=True)
|
||||
return False
|
||||
|
||||
@@ -7,7 +7,6 @@ import operator
|
||||
import tryton.common as common
|
||||
from tryton.common import RPCException, RPCExecute
|
||||
from tryton.config import CONFIG
|
||||
from tryton.exceptions import TrytonServerError
|
||||
from tryton.pyson import PYSONDecoder
|
||||
|
||||
from . import field as fields
|
||||
@@ -720,7 +719,7 @@ class Record:
|
||||
'model', self.model_name,
|
||||
'autocomplete_' + fieldname, args, context=self.get_context(),
|
||||
process_exception=False)
|
||||
except (RPCException, TrytonServerError):
|
||||
except RPCException:
|
||||
# ensure res is a list
|
||||
res = []
|
||||
self.autocompletion[fieldname] = res
|
||||
@@ -728,9 +727,12 @@ class Record:
|
||||
def on_scan_code(self, code, depends):
|
||||
depends = self.expr_eval(depends)
|
||||
values = self._get_on_change_args(depends)
|
||||
changes = RPCExecute(
|
||||
'model', self.model_name, 'on_scan_code', values, code,
|
||||
context=self.get_context(), process_exception=False)
|
||||
try:
|
||||
changes = RPCExecute(
|
||||
'model', self.model_name, 'on_scan_code', values, code,
|
||||
context=self.get_context(), process_exception=False)
|
||||
except RPCException:
|
||||
changes = []
|
||||
self.set_on_change(changes)
|
||||
self.set_modified()
|
||||
return bool(changes)
|
||||
|
||||
@@ -21,7 +21,6 @@ from tryton.common import (
|
||||
from tryton.common.domain_inversion import canonicalize
|
||||
from tryton.common.domain_parser import DomainParser
|
||||
from tryton.config import CONFIG
|
||||
from tryton.exceptions import TrytonServerError
|
||||
from tryton.gui.window.infobar import InfoBar
|
||||
from tryton.gui.window.view_form.model.group import Group
|
||||
from tryton.gui.window.view_form.view import View
|
||||
@@ -310,7 +309,7 @@ class Screen:
|
||||
'model', self.model_name, 'search_count',
|
||||
domain, 0, self.count_limit, context=context,
|
||||
process_exception=False)
|
||||
except (RPCException, TrytonServerError):
|
||||
except RPCException:
|
||||
self.search_count = 0
|
||||
else:
|
||||
self.search_count = len(ids)
|
||||
@@ -936,7 +935,7 @@ class Screen:
|
||||
json_paths, json_selected_path,
|
||||
process_exception=False)
|
||||
clear_cache('model.ir.ui.view_tree_state.get')
|
||||
except Exception:
|
||||
except RPCException:
|
||||
logger.warn(
|
||||
_('Unable to set view tree state'), exc_info=True)
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ from gi.repository import Gtk
|
||||
import tryton.common as common
|
||||
from tryton.action import Action
|
||||
from tryton.config import CONFIG
|
||||
from tryton.exceptions import TrytonServerError
|
||||
from tryton.pyson import PYSONDecoder
|
||||
|
||||
|
||||
@@ -209,7 +208,7 @@ class Link(StateMixin, Gtk.Button):
|
||||
if count > 99:
|
||||
count = '99+'
|
||||
counter[idx] = count
|
||||
except (common.RPCException, TrytonServerError):
|
||||
except common.RPCException:
|
||||
pass
|
||||
self._set_label_counter(label, counter)
|
||||
|
||||
|
||||
@@ -150,16 +150,17 @@ class Wizard(InfoBar):
|
||||
|
||||
def end(self, callback=None):
|
||||
def end_callback(action):
|
||||
self.destroy(action=action())
|
||||
if callback:
|
||||
callback()
|
||||
try:
|
||||
RPCExecute('wizard', self.action, 'delete', self.session_id,
|
||||
process_exception=False, callback=end_callback)
|
||||
except Exception:
|
||||
logger.warn(
|
||||
"Unable to delete session %s of wizard %s",
|
||||
self.session_id, self.action, exc_info=True)
|
||||
try:
|
||||
self.destroy(action=action())
|
||||
if callback:
|
||||
callback()
|
||||
except RPCException:
|
||||
logger.warn(
|
||||
"Unable to delete session %s of wizard %s",
|
||||
self.session_id, self.action, exc_info=True)
|
||||
RPCExecute(
|
||||
'wizard', self.action, 'delete', self.session_id,
|
||||
process_exception=False, callback=end_callback)
|
||||
|
||||
def clean(self):
|
||||
for widget in self.widget.get_children():
|
||||
|
||||
Reference in New Issue
Block a user