DiamondLightSource / fastcs-eiger

Prototype Eiger Control System Integration with FastCS
https://github.com/DiamondLightSource/FastCS
Apache License 2.0
1 stars 1 forks source link

Rejected responses not handled properly #20

Closed GDYendell closed 7 months ago

GDYendell commented 11 months ago

Possible just with the simulator but I imagine not.

ERROR:root:Exception when running dispatched callback
Traceback (most recent call last):
  File "/venv/lib/python3.11/site-packages/softioc/asyncio_dispatcher.py", line 45, in async_wrapper
    await ret
  File "/workspace/FastCS/src/fastcs/attributes.py", line 106, in process_without_display_update
    await self._process_callback(self._datatype.dtype(value))
  File "/workspace/FastCS/src/fastcs/backend.py", line 92, in callback
    await attribute.sender.put(controller, attribute, value)
  File "/workspace/eiger-fastcs/src/eiger_fastcs/eiger_controller.py", line 38, in put
    parameters_to_update = await controller.connection.put(self.name, value)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/FastCS/src/fastcs/connections.py", line 79, in put
    return await response.json()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1105, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('http://127.0.0.1:8080/detector/api/1.8.0/config/photon_energy')

To reproduce, set an invalid value, e.g. photon energy to zero.