Skip to content
Snippets Groups Projects
Commit a09c0916 authored by mimc's avatar mimc
Browse files

hawc2 io now prints better error messages

parent eb8674c5
No related branches found
No related tags found
No related merge requests found
......@@ -340,6 +340,7 @@ class ReadHawc2(object):
############################################################################
# get items
def __getitem__(self, key):
orig_key = key
old_key = []
while key in self.alias.keys() and not key in old_key:
old_key.append(key)
......@@ -348,6 +349,8 @@ class ReadHawc2(object):
raise Exception('Circular alias')
if isinstance(key,str) and key.isdigit():
key=int(key)
if not isinstance(key,int):
raise KeyError("Cannot resolve a signal with the key '"+str(orig_key)+"'")
return self.get_signal(key)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment