acqobj: Remove monkey patch on exception
The AcquisitionObjectIterator
looks to monkey patch received exceptions
https://gitlab.esrf.fr/bliss/bliss/-/blob/master/bliss/scanning/chain.py?ref_type=heads#L180
try:
...
except Exception as e:
e.args = (self.__acquisition_object.name, *e.args)
raise
That a very bad idea. Because we are basically mangling system exception which maybe use dedicated API, or user exceptions that nobody except to have such "arguments".
If such information have to be raised the exceptions should be chained the following way:
class AcquisitionObjectError(RuntimeError):
def __init__(self, acq_obj_name: str):
self.acq_obj_name = acq_obj_name
super(f"Error raised during the processing of the acqobj {acq_obj_name}")
try:
...
except Exception as e:
raise AcquisitionObjectError(self.__acquisition_object.name) from e
It would be good to check if such code can be fixed.
Edited by Valentin Valls