cantera/interfaces/python/Cantera/exceptions.py
Ray Speth 6cb4bd93ce Cleaned up whitespace in all Python files using reindent.py
4 spaces per indentation level, no tabs, no trailing whitespace,
and a single newline at end of each file.
2012-02-27 18:13:05 +00:00

26 lines
680 B
Python
Executable file

"""
Cantera exceptions
"""
import _cantera
def getCanteraError():
"""
Get an error message generated when Cantera throws an exception.
"""
return _cantera.get_Cantera_Error()
class CanteraError(Exception):
def __init__(self, msg = ""):
if msg == "":
msg = _cantera.get_Cantera_Error()
self.msg = msg
def __str__(self):
print '\n\n\n####################### CANTERA ERROR ######################\n'
print ' ',self.msg
print '\n##############################################################\n'
class OptionError(CanteraError):
def __init__(self, msg):
self.msg = 'Unknown option: '+msg