From b6a798662625bc911b5a1a19dd589d6e7d378ad9 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 27 Apr 2023 13:44:41 -0700 Subject: [PATCH] add more detailed error msg --- d2plugin/plugin_features.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/d2plugin/plugin_features.go b/d2plugin/plugin_features.go index c6db35326..5ca6aef51 100644 --- a/d2plugin/plugin_features.go +++ b/d2plugin/plugin_features.go @@ -35,12 +35,12 @@ func FeatureSupportCheck(info *PluginInfo, g *d2graph.Graph) error { for _, obj := range g.Objects { if obj.Top != nil || obj.Left != nil { if _, ok := featureMap[TOP_LEFT]; !ok { - return fmt.Errorf(`Object "%s" has attribute "top" and/or "left" set, but layout engine "%s" does not support locked positions.`, obj.AbsID(), info.Name) + return fmt.Errorf(`Object "%s" has attribute "top" and/or "left" set, but layout engine "%s" does not support locked positions. See https://d2lang.com/tour/layouts/#layout-specific-functionality for more.`, obj.AbsID(), info.Name) } } if (obj.WidthAttr != nil || obj.HeightAttr != nil) && len(obj.ChildrenArray) > 0 { if _, ok := featureMap[CONTAINER_DIMENSIONS]; !ok { - return fmt.Errorf(`Object "%s" has attribute "width" and/or "height" set, but layout engine "%s" does not support dimensions set on containers.`, obj.AbsID(), info.Name) + return fmt.Errorf(`Object "%s" has attribute "width" and/or "height" set, but layout engine "%s" does not support dimensions set on containers. See https://d2lang.com/tour/layouts/#layout-specific-functionality for more.`, obj.AbsID(), info.Name) } } @@ -48,7 +48,7 @@ func FeatureSupportCheck(info *PluginInfo, g *d2graph.Graph) error { _, isKey := g.Root.HasChild(d2graph.Key(obj.NearKey)) if isKey { if _, ok := featureMap[NEAR_OBJECT]; !ok { - return fmt.Errorf(`Object "%s" has "near" set to another object, but layout engine "%s" only supports constant values for "near".`, obj.AbsID(), info.Name) + return fmt.Errorf(`Object "%s" has "near" set to another object, but layout engine "%s" only supports constant values for "near". See https://d2lang.com/tour/layouts/#layout-specific-functionality for more.`, obj.AbsID(), info.Name) } } } @@ -63,10 +63,10 @@ func FeatureSupportCheck(info *PluginInfo, g *d2graph.Graph) error { continue } if e.Src == e.Dst { - return fmt.Errorf(`Connection "%s" is a self loop on a container, but layout engine "%s" does not support this.`, e.AbsID(), info.Name) + return fmt.Errorf(`Connection "%s" is a self loop on a container, but layout engine "%s" does not support this. See https://d2lang.com/tour/layouts/#layout-specific-functionality for more.`, e.AbsID(), info.Name) } if e.Src.IsDescendantOf(e.Dst) || e.Dst.IsDescendantOf(e.Src) { - return fmt.Errorf(`Connection "%s" goes from a container to a descendant, but layout engine "%s" does not support this.`, e.AbsID(), info.Name) + return fmt.Errorf(`Connection "%s" goes from a container to a descendant, but layout engine "%s" does not support this. See https://d2lang.com/tour/layouts/#layout-specific-functionality for more.`, e.AbsID(), info.Name) } } }