Skip to content

Commit

Permalink
feat: add error type for no map
Browse files Browse the repository at this point in the history
  • Loading branch information
owulveryck committed Jun 12, 2023
1 parent cb246f1 commit 2690090
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parser/wtg/parse.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package wtg

import (
"errors"
"fmt"
"image"
"io"
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2690090

Please sign in to comment.