Commit b7731a58 authored by Cyril Guilloud's avatar Cyril Guilloud Committed by Antonia Beteva

added icepap connection errors mangement.

parent 23a3947b
......@@ -21,6 +21,8 @@ from bliss.comm.tcp import Command
import struct
import numpy
import sys
import os
import errno
def _object_method_filter(obj):
......@@ -662,6 +664,28 @@ def _vdata_header(data, axis, vdata_type):
def _command(cnx, cmd, data=None, pre_cmd=None):
return _command_raw(cnx, cmd, data, pre_cmd)
except IOError as ioex:
if ioex.errno == 113:
_msg = f"IOError {ioex.errno}:{errno.errorcode[ioex.errno]}"
_msg += f"\nmessage={os.strerror(ioex.errno)} "
_msg += f"\nPlease check that icepap controller '{cnx._host}' is ON"
raise RuntimeError(_msg)
elif ioex.errno == -2:
_msg = f"IOError {ioex.errno}"
_msg += f"\nPlease check icepap controller: '{cnx._host}'"
raise RuntimeError(_msg)
raise ioex
except OSError as osex:
_msg = f"OSError no:{osex.errno}"
_msg += f"err code:{errno.errorcode[osex.errno]}"
_msg += f"err message:{os.strerror(osex.errno)}"
raise RuntimeError(_msg)
def _command_raw(cnx, cmd, data=None, pre_cmd=None):
reply_flag = _check_reply.match(cmd)
cmd = cmd.encode()
if data is not None:
......@@ -147,3 +147,10 @@ def test_config_save_reference(beacon, beacon_directory):
== rw_cfg["dict_list"][2]["instance"].name
def test_bad_icepap_host(beacon):
bad_mot = beacon.get("v6biturbo")
with pytest.raises(RuntimeError):
a = bad_mot.position
class: icepap
host: iceid666
name: iceid666
- name: v6biturbo
address: 1
steps_per_unit: 10000
sign: 1
velocity: 0.2
acceleration: 0.8
backlash: 0.005
high_limit: -84.0007
low_limit: -154.501
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