@@ -491,7 +491,7 @@ class NodeConnectionManager {
491491 await Promise . all ( destroyProms ) ;
492492 await this . quicServer . stop ( { force : true } ) ;
493493 await this . quicSocket . stop ( { force : true } ) ;
494- await this . rpcServer ?. destroy ( { force : true , reason : Error ( 'TMP NCM stopping' ) } ) ; // TODO
494+ await this . rpcServer ?. destroy ( { force : true , reason : new nodesErrors . ErrorNodeConnectionManagerStopping ( ) } ) ;
495495 this . logger . info ( `Stopped ${ this . constructor . name } ` ) ;
496496 }
497497
@@ -740,7 +740,7 @@ class NodeConnectionManager {
740740 ) : Promise < Map < NodeIdString , ConnectionAndTimer > > {
741741 const nodesEncoded = nodeIds . map ( ( v ) => nodesUtils . encodeNodeId ( v ) ) ;
742742 this . logger . debug ( `getting multi-connection for ${ nodesEncoded } ` ) ;
743- if ( nodeIds . length === 0 ) throw Error ( 'TMP, must provide at least 1 node' ) ;
743+ if ( nodeIds . length === 0 ) throw new nodesErrors . ErrorNodeConnectionManagerNodeIdRequired ( ) ;
744744 const connectionsResults : Map < NodeIdString , ConnectionAndTimer > = new Map ( ) ;
745745 // 1. short circuit any existing connections
746746 const nodesShortlist : Set < NodeIdString > = new Set ( ) ;
@@ -816,9 +816,12 @@ class NodeConnectionManager {
816816 await Promise . allSettled ( connProms ) ;
817817 }
818818 if ( connectionsResults . size === 0 ) {
819- // TODO: This needs to throw if none were established.
820- // The usual use case is a single node, this shouldn't be a aggregate error type.
821- throw Error ( 'TMP No connections established!' ) ;
819+ throw new nodesErrors . ErrorNodeConnectionManagerMultiConnectionFailed (
820+ undefined ,
821+ {
822+ cause : new AggregateError ( await Promise . allSettled ( connProms ) )
823+ }
824+ ) ;
822825 }
823826 return connectionsResults ;
824827 }
@@ -885,6 +888,8 @@ class NodeConnectionManager {
885888 // 3. if already exists then clean up
886889 await connection . destroy ( { force : true } ) ;
887890 // I can only see this happening as a race condition with creating a forward connection and receiving a reverse.
891+ // FIXME: only here to see if this condition happens.
892+ // this NEEDS to be removed, but I want to know if this branch happens at all.
888893 throw Error (
889894 'TMP IMP, This should be exceedingly rare, lets see if it happens' ,
890895 ) ;
0 commit comments