Skip to content

Commit

Permalink
Merge pull request #122 from lsst-ts/tickets/DM-42478
Browse files Browse the repository at this point in the history
DM-42478: Fix handling error in querying Simbad database
  • Loading branch information
tribeiro authored Jan 12, 2024
2 parents 9b04519 + 2b2dd02 commit a5f6106
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/news/DM-42478.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In ``base_tcs.py``, update ``find_target_simbad`` to capture any exception when executing the remote query and retrow them as a ``RuntimeError``.

10 changes: 7 additions & 3 deletions python/lsst/ts/observatory/control/base_tcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,9 +1656,13 @@ async def find_target_simbad(

loop = asyncio.get_event_loop()

result_table = await loop.run_in_executor(
None, customSimbad.query_criteria, criteria
)
try:
result_table = await loop.run_in_executor(
None, customSimbad.query_criteria, criteria
)
except Exception as e:
self.log.exception("Querying Simbad failed. {criteria=}")
raise RuntimeError(f"Query {criteria=} failed: {e!r}")

if result_table is None:
raise RuntimeError(f"No result from query: {criteria}.")
Expand Down

0 comments on commit a5f6106

Please sign in to comment.