Skip to content

Commit

Permalink
🥅 Add custom WidgetCommunicationError
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Jul 18, 2024
1 parent a50339b commit 953c3b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/ipyaladin/errors/widget_communication_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class WidgetCommunicationError(OSError):
"""Error raised when there is a communication error with the widget."""

def __init__(self, message: str) -> None:
self.message = message
super(WidgetCommunicationError, self).__init__(message)
6 changes: 4 additions & 2 deletions src/ipyaladin/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import traitlets
from astropy.wcs import WCS

from .errors.widget_communication_error import WidgetCommunicationError

try:
from regions import (
CircleSkyRegion,
Expand Down Expand Up @@ -202,7 +204,7 @@ def wcs(self) -> WCS:
"""
if self._wcs == {}:
raise ValueError(
raise WidgetCommunicationError(
"The world coordinate system is not available. "
"Please recover it from another cell."
)
Expand All @@ -221,7 +223,7 @@ def fov_xy(self) -> Tuple[Angle, Angle]:
"""
if self._fov_xy == {}:
raise ValueError(
raise WidgetCommunicationError(
"The field of view along the two axes is not available. "
"Please recover it from another cell."
)
Expand Down

0 comments on commit 953c3b7

Please sign in to comment.