diff --git a/xga/exceptions.py b/xga/exceptions.py index b5d2f59c..587c275d 100644 --- a/xga/exceptions.py +++ b/xga/exceptions.py @@ -1,5 +1,5 @@ # This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS). -# Last modified by David J Turner (turne540@msu.edu) 22/09/2023, 16:27. Copyright (c) The Contributors +# Last modified by David J Turner (turne540@msu.edu) 22/09/2023, 16:37. Copyright (c) The Contributors class HeasoftError(Exception): @@ -633,3 +633,22 @@ def __str__(self): else: return 'NoTelescopeDataError has been raised' + +class InvalidTelescopeError(Exception): + def __init__(self, *args): + """ + Raised when the name of a telescope has been passed to a function, but it is not recognised or supported. + :param expression: + :param message: + """ + if args: + self.message = args[0] + else: + self.message = None + + def __str__(self): + if self.message: + return '{}'.format(self.message) + else: + return 'InvalidTelescopeError has been raised' +