mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-09-10 11:40:41 +08:00
REFACTOR: indicio.utils.__init__.py to multiple utils modules
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user