Skip to content

Commit

Permalink
[Adapter] - Making validation errors more visible
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-oscarsson committed Feb 7, 2025
1 parent 3324554 commit 3d9785f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mxcubeweb/core/adapter/beamline_adapter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
import logging

import pydantic

BEAMLINE_ADAPTER = None

# Singleton like interface is needed to keep the same reference to the
Expand Down Expand Up @@ -67,7 +69,12 @@ def dict(self):
attributes = {}

for attr_name in self.app.mxcubecore.adapter_dict:
_d = self.app.mxcubecore.get_adapter(attr_name).dict()
try:
_d = self.app.mxcubecore.get_adapter(attr_name).dict()
except pydantic.ValidationError:
logging.getLogger("MX3.HWR").error(f"Incorrect values in {attr_name}")
logging.getLogger("MX3.HWR").exception("")

attributes.update({attr_name: _d})

return {"hardwareObjects": attributes}
Expand Down

0 comments on commit 3d9785f

Please sign in to comment.