Permalink
Browse files

Improve error handling.

  • Loading branch information...
1 parent 51d6d6b commit 104d549f0df7fa8ab8c2fc3abffbaa7ced04038e @gsavin gsavin committed Jan 19, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/org/graphstream/ui/graphicGraph/GraphicGraph.java
@@ -423,9 +423,11 @@ protected GraphicEdge addEdge(String sourceId, long timeId, String id,
GraphicNode n1 = (GraphicNode) styleGroups.getNode(from);
GraphicNode n2 = (GraphicNode) styleGroups.getNode(to);
- if (n1 == null || n2 == null)
- throw new RuntimeException(
- "org.miv.graphstream.ui.graphicGraph.GraphicGraph.addEdge() : ERROR : one of the nodes does not exist");
+ if (n1 == null)
+ throw new ElementNotFoundException("node \"%s\"", from);
+
+ if (n2 == null)
+ throw new ElementNotFoundException("node \"%s\"", to);
edge = new GraphicEdge(id, n1, n2, directed, attributes);

0 comments on commit 104d549

Please sign in to comment.