def setError(self,error,code=None):
        """ Set the error code. Obsolette. Use error-conditions instead. """
        if code:
            if str(code) in _errorcodes.keys(): error=ErrorNode(_errorcodes[str(code)],text=error)
            else: error=ErrorNode(ERR_UNDEFINED_CONDITION,code=code,typ='cancel',text=error)
        elif type(error) in [type(''),type(u'')]: error=ErrorNode(error)
        self.setType('error')
        self.addChild(node=error)
 Set the error code. Obsolette. Use error-conditions instead. 
chrome-cordova/gcmServer/xmpp/protocol.py