Skip to content

Commit

Permalink
Catch connection error
Browse files Browse the repository at this point in the history
  • Loading branch information
duytnguyendtn committed May 14, 2024
1 parent 2f945b2 commit c903948
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from astropy import units as u
from pyvo.utils import vocabularies
from pyvo import registry
from pyvo.dal.exceptions import DALFormatError
from requests.exceptions import ConnectionError as RequestConnectionError
from traitlets import Dict, Bool, Unicode, Any, List, Int

from jdaviz.core.events import SnackbarMessage
Expand Down Expand Up @@ -59,9 +61,12 @@ def vue_waveband_selected(self,event):
if event is not None:
self._full_registry_results = registry.search(registry.Servicetype("sia"), registry.Waveband(self.waveband_selected))
self.resources = list(self._full_registry_results.getcolumn("short_name"))
except Exception:
# TODO: Catch connection error
raise
except DALFormatError as e:
if type(e.cause) is RequestConnectionError:
self.hub.broadcast(SnackbarMessage(
f"Unable to connect to VO registry. Please check your internet connection: {e}", sender=self, color="error"))
else:
raise e
finally:
self.resources_loading = False # Stop loading bar

Expand Down

0 comments on commit c903948

Please sign in to comment.