How to use the fcp.node.FCPException function in fcp

To help you get started, we’ve selected a few fcp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freenet / pyFreenet / fcp / node.py View on Github external
def __str__(self):
        
        parts = []
        for k in ['header', 'ShortCodeDescription', 'CodeDescription']:
            if self.info.has_key(k):
                parts.append(str(self.info[k]))
        return ";".join(parts) or "??"

class FCPGetFailed(FCPException):
    pass

class FCPPutFailed(FCPException):
    pass

class FCPProtocolError(FCPException):
    pass

class FCPNodeFailure(Exception):
    """
    node seems to have died
    """

class FCPSendTimeout(FCPException):
    """
    timed out waiting for command to be sent to node
    """
    pass

class FCPNodeTimeout(FCPException):
    """
    timed out waiting for node to respond
github freenet / pyFreenet / fcp / node.py View on Github external
#print "Creating fcp exception"
        if not info:
            info = kw
        self.info = info
        #print "fcp exception created"
        Exception.__init__(self, str(info))

    def __str__(self):
        
        parts = []
        for k in ['header', 'ShortCodeDescription', 'CodeDescription']:
            if self.info.has_key(k):
                parts.append(str(self.info[k]))
        return ";".join(parts) or "??"

class FCPGetFailed(FCPException):
    pass

class FCPPutFailed(FCPException):
    pass

class FCPProtocolError(FCPException):
    pass

class FCPNodeFailure(Exception):
    """
    node seems to have died
    """

class FCPSendTimeout(FCPException):
    """
    timed out waiting for command to be sent to node
github freenet / pyFreenet / fcp / node.py View on Github external
job.callback('failed', msg)
            job._putResult(FCPProtocolError(msg))
            return
    
        if hdr == 'IdentifierCollision':
            log(ERROR, "IdentifierCollision on id %s ???" % id)
            job.callback('failed', msg)
            job._putResult(Exception("Duplicate job identifier %s" % id))
            return
    
        # -----------------------------
        # wtf is happening here?!?
    
        log(ERROR, "Unknown message type from node: %s" % hdr)
        job.callback('failed', msg)
        job._putResult(FCPException(msg))
        return
    #@-node:_on_rxMsg
github freenet / pyFreenet / fcp / node.py View on Github external
class FCPProtocolError(FCPException):
    pass

class FCPNodeFailure(Exception):
    """
    node seems to have died
    """

class FCPSendTimeout(FCPException):
    """
    timed out waiting for command to be sent to node
    """
    pass

class FCPNodeTimeout(FCPException):
    """
    timed out waiting for node to respond
    """

class FCPNameLookupFailure(Exception):
    """
    name services name lookup failed
    """

#@-node:exceptions
#@+node:globals
# where we can find the freenet node FCP port
defaultFCPHost = "127.0.0.1"
defaultFCPPort = 9481
defaultFProxyHost = "127.0.0.1"
defaultFProxyPort = 8888
github freenet / pyFreenet / refbot.py View on Github external
log("*** ERROR: No %s field in ref" % ( require_ref_field ));
                    log("***");
                    ref_has_syntax_problem = True;
            if(ref_has_syntax_problem):
                self.setup_refurl( opts );
                continue;
            if( ref_fieldset[ "identity" ] != self.nodeDarknetIdentity ):
                log("***");
                log("*** ERROR: The bot advertised ref's identity does not match the node's identity; perhaps your FCP host/port setting is wrong?");
                log("***");
                self.setup_refurl( opts );
                continue;
            log("Test adding advertised ref...");
            try:
                addpeer_result = f.addpeer( kwdict = ref_fieldset )
            except fcp.node.FCPException, msg:
                if( 21 == msg.info[ 'Code' ] ):
                    log("***");
                    log("*** ERROR: The node had trouble parsing the bot advertised ref");
                    log("***");
                    self.setup_refurl( opts );
                    continue;
                elif( 27 == msg.info[ 'Code' ] ):
                    log("***");
                    log("*** ERROR: The node could not verify the signature of the bot advertised ref");
                    log("***");
                    self.setup_refurl( opts );
                    continue;
                elif( 28 == msg.info[ 'Code' ] ):
                    log("The bot advertised ref appears to be good");
                    break;
                elif( 29 == msg.info[ 'Code' ] ):
github freenet / pyFreenet / fcp / node.py View on Github external
class FCPGetFailed(FCPException):
    pass

class FCPPutFailed(FCPException):
    pass

class FCPProtocolError(FCPException):
    pass

class FCPNodeFailure(Exception):
    """
    node seems to have died
    """

class FCPSendTimeout(FCPException):
    """
    timed out waiting for command to be sent to node
    """
    pass

class FCPNodeTimeout(FCPException):
    """
    timed out waiting for node to respond
    """

class FCPNameLookupFailure(Exception):
    """
    name services name lookup failed
    """

#@-node:exceptions
github freenet / pyFreenet / fcp / node.py View on Github external
self.info = info
        #print "fcp exception created"
        Exception.__init__(self, str(info))

    def __str__(self):
        
        parts = []
        for k in ['header', 'ShortCodeDescription', 'CodeDescription']:
            if self.info.has_key(k):
                parts.append(str(self.info[k]))
        return ";".join(parts) or "??"

class FCPGetFailed(FCPException):
    pass

class FCPPutFailed(FCPException):
    pass

class FCPProtocolError(FCPException):
    pass

class FCPNodeFailure(Exception):
    """
    node seems to have died
    """

class FCPSendTimeout(FCPException):
    """
    timed out waiting for command to be sent to node
    """
    pass