diff --git a/secop/client/__init__.py b/secop/client/__init__.py index 37a8054..a1855e5 100644 --- a/secop/client/__init__.py +++ b/secop/client/__init__.py @@ -493,17 +493,12 @@ class SecopClient(ProxyClient): self.log.warning('unhandled message: %s %s %r' % (action, ident, data)) def _set_state(self, online, state=None): - # treat reconnecting as online! - state = state or self.state - try: - self.callback(None, 'nodeStateChange', online, state) - for mname in self.modules: - self.callback(mname, 'nodeStateChange', online, state) - except Exception as e: - self.log.error('ERROR in nodeStateCallback %s', e) - # set online attribute after callbacks -> callback may check for old state + # remark: reconnecting is treated as online self.online = online - self.state = state + self.state = state or self.state + self.callback(None, 'nodeStateChange', self.online, self.state) + for mname in self.modules: + self.callback(mname, 'nodeStateChange', self.online, self.state) def queue_request(self, action, ident=None, data=None): """make a request""" @@ -522,8 +517,8 @@ class SecopClient(ProxyClient): raise ConnectionError('connection closed before reply') action, _, data = entry[2] # pylint: disable=unpacking-non-sequence if action.startswith(ERRORPREFIX): - errcls = self.error_map(data[0]) - raise errcls('on SEC-Node: ' + data[1]) + errcls = self.error_map(data[0] + "Error") + raise errcls(data[1]) return entry[2] # reply def request(self, action, ident=None, data=None):