diff --git a/src/ipyaladin/widget.py b/src/ipyaladin/widget.py index 991d010..fa4907a 100644 --- a/src/ipyaladin/widget.py +++ b/src/ipyaladin/widget.py @@ -389,12 +389,17 @@ def target(self, target: Union[str, SkyCoord, Tuple[float, float]]) -> None: try: target = parse_coordinate_string(target, self._survey_body) except NameResolveError as e: + # If the widget is not ready, we don't know if the base survey is + # celestial or planetary so the error can be caused by two factors if not self._ready: raise WidgetCommunicationError( - f"Either '{target}' is not a valid object name, or " - f"the survey body type is not yet defined so you " - f"need to set the target from another cell." + f"Either '{target}' is not a valid celestial object name, " + f"or the survey body type is not yet defined so you " + f"need to wait for the widget to be fully loaded." ) from e + # If the widget is ready, the error is caused by the target name + # that is not a valid celestial object name + raise e elif not isinstance(target, SkyCoord) and not isinstance( target, Tuple ): # If the target is not str or SkyCoord