def add_error(name=None, code=None, status=None):
if not name or not status or not code:<EOL><INDENT>raise Exception("<STR_LIT>" % name)<EOL><DEDENT>myexception = type(name, (PyMacaronException, ), {"<STR_LIT:code>": code, "<STR_LIT:status>": status})<EOL>globals()[name] = myexception<EOL>if code in code_to_class:<EOL><INDENT>raise Exception("<STR_LIT>" % code)<EOL><DEDENT>code_to_class[code] = myexception<EOL>return myexception<EOL>
Create a new Exception class