REFACTOR: indicio.utils.__init__.py to multiple utils modules

This commit is contained in:
Chris Lee
2015-06-10 12:52:02 -04:00
parent 585fd16fae
commit 074a15c562
10 changed files with 181 additions and 160 deletions
+18
View File
@@ -1,2 +1,20 @@
"""
Contains Indico Custom Errors
"""
class IndicoError(ValueError):
pass
class DataStructureException(Exception):
"""
If a non-accepted datastructure is passed, throws an exception
"""
def __init__(self, callback, passed_structure, accepted_structures):
self.callback = callback.__name__
self.structure = str(type(passed_structure))
self.accepted = [str(structure) for structure in accepted_structures]
def __str__(self):
return """
function %s does not accept %s, accepted types are: %s
""" % (self.callback, self.structure, str(self.accepted))