From 2690090791c23a974d3d9de31dda6142bb05d95d Mon Sep 17 00:00:00 2001 From: Olivier Wulveryck Date: Mon, 12 Jun 2023 19:47:58 +0200 Subject: [PATCH] feat: add error type for no map --- parser/wtg/parse.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parser/wtg/parse.go b/parser/wtg/parse.go index 359967b..d9693b6 100644 --- a/parser/wtg/parse.go +++ b/parser/wtg/parse.go @@ -1,6 +1,7 @@ package wtg import ( + "errors" "fmt" "image" "io" @@ -11,6 +12,8 @@ import ( svgmap "github.com/owulveryck/wardleyToGo/encoding/svg" ) +var ErrEmptyMap = errors.New("no map") + type Parser struct { visibilityOnly bool WMap *wardleyToGo.Map @@ -60,7 +63,7 @@ func (p *Parser) parse(s string) error { return fmt.Errorf("error in parsing: %w", err) } if len(inv.NodeInventory) == 0 { - return fmt.Errorf("no map") + return ErrEmptyMap } m, err := consolidateMap(inv.NodeInventory, inv.EdgeInventory) if err != nil {