Skip to content

Commit

Permalink
Added another XGA error, where a telescope name is not recognised or …
Browse files Browse the repository at this point in the history
…supported
  • Loading branch information
DavidT3 committed Sep 22, 2023
1 parent 185186e commit 1b2330d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion xga/exceptions.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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'

0 comments on commit 1b2330d

Please sign in to comment.