Skip to content

Commit 34ea21b

Browse files
committed
Added NoTelescopeDataError and InvalidTelescopeError exceptions from the multi-mission XGA branch. For issue #1430
1 parent 9b38815 commit 34ea21b

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

xga/exceptions.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
2-
# Last modified by David J Turner (turne540@msu.edu) 26/03/2025, 18:04. Copyright (c) The Contributors
2+
# Last modified by David J Turner (turne540@msu.edu) 25/08/2025, 13:58. Copyright (c) The Contributors
33

44

55
class HeasoftError(Exception):
@@ -648,4 +648,42 @@ def __str__(self):
648648
if self.message:
649649
return '{}'.format(self.message)
650650
else:
651-
return 'FitConfNotAssociatedError has been raised'
651+
return 'FitConfNotAssociatedError has been raised'
652+
653+
class NoTelescopeDataError(Exception):
654+
def __init__(self, *args):
655+
"""
656+
Raised when a part of XGA that directly accesses telescope data is used, but there are no relevant
657+
telescopes setup in the configuration file.
658+
:param expression:
659+
:param message:
660+
"""
661+
if args:
662+
self.message = args[0]
663+
else:
664+
self.message = None
665+
666+
def __str__(self):
667+
if self.message:
668+
return '{}'.format(self.message)
669+
else:
670+
return 'NoTelescopeDataError has been raised'
671+
672+
673+
class InvalidTelescopeError(Exception):
674+
def __init__(self, *args):
675+
"""
676+
Raised when the name of a telescope has been passed to a function, but it is not recognised or supported.
677+
:param expression:
678+
:param message:
679+
"""
680+
if args:
681+
self.message = args[0]
682+
else:
683+
self.message = None
684+
685+
def __str__(self):
686+
if self.message:
687+
return '{}'.format(self.message)
688+
else:
689+
return 'InvalidTelescopeError has been raised'

0 commit comments

Comments
 (0)