mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-06-27 16:10:34 +08:00
21 lines
622 B
Python
21 lines
622 B
Python
"""
|
|
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))
|