Skip to content

Commit

Permalink
encoding/dot: pass returned error up call stack
Browse files Browse the repository at this point in the history
This should probably use a rich error strategy, but we can leave that for
when the Go error handling experiments are more fully developed.
  • Loading branch information
kortschak committed Nov 25, 2018
1 parent cdf8233 commit 4fc8509
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions graph/encoding/dot/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (gen *simpleGraph) addStmt(dst encoding.Builder, stmt ast.Stmt) {
Value: attr.Val,
}
if err := n.SetAttribute(a); err != nil {
panic(fmt.Errorf("unable to unmarshal node DOT attribute (%s=%s)", a.Key, a.Value))
panic(fmt.Errorf("unable to unmarshal node DOT attribute (%s=%s): %v", a.Key, a.Value, err))
}
}
case *ast.EdgeStmt:
Expand Down Expand Up @@ -220,7 +220,7 @@ func (gen *simpleGraph) addStmt(dst encoding.Builder, stmt ast.Stmt) {
Value: attr.Val,
}
if err := n.SetAttribute(a); err != nil {
panic(fmt.Errorf("unable to unmarshal global %s DOT attribute (%s=%s)", dst, a.Key, a.Value))
panic(fmt.Errorf("unable to unmarshal global %s DOT attribute (%s=%s): %v", dst, a.Key, a.Value, err))
}
}
case *ast.Attr:
Expand Down Expand Up @@ -376,7 +376,7 @@ func (gen *multiGraph) addStmt(dst encoding.MultiBuilder, stmt ast.Stmt) {
Value: attr.Val,
}
if err := n.SetAttribute(a); err != nil {
panic(fmt.Errorf("unable to unmarshal node DOT attribute (%s=%s)", a.Key, a.Value))
panic(fmt.Errorf("unable to unmarshal node DOT attribute (%s=%s): %v", a.Key, a.Value, err))
}
}
case *ast.EdgeStmt:
Expand Down Expand Up @@ -412,7 +412,7 @@ func (gen *multiGraph) addStmt(dst encoding.MultiBuilder, stmt ast.Stmt) {
Value: attr.Val,
}
if err := n.SetAttribute(a); err != nil {
panic(fmt.Errorf("unable to unmarshal global %s DOT attribute (%s=%s)", dst, a.Key, a.Value))
panic(fmt.Errorf("unable to unmarshal global %s DOT attribute (%s=%s): %v", dst, a.Key, a.Value, err))
}
}
case *ast.Attr:
Expand Down Expand Up @@ -489,7 +489,7 @@ func addEdgeAttrs(edge graph.Edge, attrs []*ast.Attr) {
Value: attr.Val,
}
if err := e.SetAttribute(a); err != nil {
panic(fmt.Errorf("unable to unmarshal edge DOT attribute (%s=%s)", a.Key, a.Value))
panic(fmt.Errorf("unable to unmarshal edge DOT attribute (%s=%s): %v", a.Key, a.Value, err))
}
}
}

0 comments on commit 4fc8509

Please sign in to comment.