diff --git a/packages/node/src/handlers.ts b/packages/node/src/handlers.ts index 774f9bbd..39d5b7a0 100644 --- a/packages/node/src/handlers.ts +++ b/packages/node/src/handlers.ts @@ -94,9 +94,9 @@ function updateHandler(node: TopologyNode, data: Uint8Array) { ); }; - try{ + try { _merge(); - }catch(err){ + } catch (err) { if (updateMessage.vertices.length === 0) { return false; } else { @@ -105,7 +105,7 @@ function updateHandler(node: TopologyNode, data: Uint8Array) { _merge(); } } - + node.objectStore.put(object.id, object); return true; @@ -187,13 +187,12 @@ function syncAcceptHandler( }); if (vertices.length !== 0) { - try{ + try { object.merge(vertices); - }catch(err){ + } catch (err) { node.syncObject(object.id, sender); console.log("ERROR MERGING VERTICES"); object.merge(vertices); - } node.objectStore.put(object.id, object); } diff --git a/packages/object/src/hashgraph/index.ts b/packages/object/src/hashgraph/index.ts index 18945fa4..e6fa18f0 100644 --- a/packages/object/src/hashgraph/index.ts +++ b/packages/object/src/hashgraph/index.ts @@ -128,10 +128,7 @@ export class HashGraph { if ( !deps.every((dep) => this.forwardEdges.has(dep) || this.vertices.has(dep)) ) { - console.log("Node ID ", nodeId); - console.error("Invalid dependency detected."); throw new Error("Invalid dependency detected."); - return ""; } const vertex: Vertex = { diff --git a/packages/object/src/index.ts b/packages/object/src/index.ts index 534fa4c4..3389003a 100644 --- a/packages/object/src/index.ts +++ b/packages/object/src/index.ts @@ -103,16 +103,12 @@ export class TopologyObject implements ITopologyObject { if (!vertex.operation) { continue; } - try{ - this.hashGraph.addVertex( - vertex.operation, - vertex.dependencies, - vertex.nodeId, - ); - }catch(err){ - throw new Error("Error merging vertex"); - } - + + this.hashGraph.addVertex( + vertex.operation, + vertex.dependencies, + vertex.nodeId, + ); } const operations = this.hashGraph.linearizeOperations();