Skip to content

Commit

Permalink
chore: best effort print
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Musat committed Dec 12, 2022
1 parent aceba27 commit 30e69fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ var Root = &cobra.Command{
content, err := graph.RenderGraph[js.Data](entrypoint, &js.Parser{
RootDir: path.Dir(entrypoint),
})
print(content)
if err != nil {
return err
}
print(content)
} else {
return errors.New("file not supported")
}
Expand Down
10 changes: 8 additions & 2 deletions internal/board/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package board

import (
"fmt"
"strings"

"github.com/elliotchance/orderedmap/v2"

Expand Down Expand Up @@ -31,7 +32,7 @@ func (b *Board) Render() (string, error) {
block, _ := b.blocks.Get(k)
err := block.Render(matrix)
if err != nil {
return "", fmt.Errorf("error rendering block %s: %w", block.Id, err)
return matrix.Render(), fmt.Errorf("error rendering block %s: %w", block.Label, err)
}
}

Expand All @@ -40,7 +41,12 @@ func (b *Board) Render() (string, error) {
connector, _ := b.connectors.Get(k)
err := connector.Render(matrix)
if err != nil {
return "", fmt.Errorf("error rendering connector from %s to %s: %w", connector.from.Id, connector.to.Id, err)
return matrix.Render(), fmt.Errorf(
"error rendering connector from %s to %s: %w",
strings.TrimSpace(connector.from.Label),
strings.TrimSpace(connector.to.Label),
err,
)
}
}

Expand Down

0 comments on commit 30e69fc

Please sign in to comment.