ALBA-Synchrotron / sardana-tango

Repository for Sardana Tango plugins (TangoAttributeCtrls, etc)
GNU General Public License v3.0
0 stars 3 forks source link

Improve error messages (fix #15) #17

Closed ovallcorba closed 9 months ago

ovallcorba commented 10 months ago

This PR Addresses the error handling and messaging pointed out by @marceloalcocer in https://github.com/ALBA-Synchrotron/sardana-tango/issues/15.

An improved explanation message has been included in the case the value is out of the current ior calibration and the local exception handling now re-raises the exception including the message (before it was returning None and it was _read_axis_value of PoolController raising the ValueError general exception). Now the output is the following:

Door_macroserver_1 [100]: dev = tango.DeviceProxy("bl16/ct/bl16ghs01")

Door_macroserver_1 [101]: dev.dummy_MFC_01_set
        Result [101]: 5.0

Door_macroserver_1 [102]: tango_ior01.tangoAttribute
        Result [102]: 'bl16/ct/bl16ghs01/dummy_MFC_01_set'

Door_macroserver_1 [103]: tango_ior01.calibration
        Result [103]: '[[0.9, 1.0, 1.1], [1.9, 2.0, 2.1], [2.9, 3.0, 3.1]]'

Door_macroserver_1 [103]: tango_ior01.value
PyDs_PythonError: ValueError: Value (5.0) out of calibration bounds. Please review ior calibration or write a valid value to the underlying tango attribute: bl16/ct/bl16ghs01.dummy_MFC_01_set

I started with this one but probably other error messages in sardana_tango controllers could be improved as well.

rhomspuron commented 9 months ago

thanks @ovallcorba and @marceloalcocer for do it and report it. We can integrate it.