MCPcopy Index your code
hub / github.com/g3n/engine / err

Method err

gui/builder.go:1108–1132  ·  view source on GitHub ↗

err creates and returns an error for the current object, field name and with the specified message

(am map[string]interface{}, fname, msg string)

Source from the content-addressed store, hash-verified

1106
1107// err creates and returns an error for the current object, field name and with the specified message
1108func (b *Builder) err(am map[string]interface{}, fname, msg string) error {
1109
1110 // Get path of objects till the error
1111 names := []string{}
1112 var name string
1113 for {
1114 if v := am[AttribName]; v != nil {
1115 name = v.(string)
1116 } else {
1117 name = "?"
1118 }
1119 names = append(names, name)
1120 var par interface{}
1121 if par = am[AttribParentInternal]; par == nil {
1122 break
1123 }
1124 am = par.(map[string]interface{})
1125 }
1126 path := []string{}
1127 for i := len(names) - 1; i >= 0; i-- {
1128 path = append(path, names[i])
1129 }
1130
1131 return fmt.Errorf("Error in object:%s field:%s -> %s", strings.Join(path, "/"), fname, msg)
1132}
1133
1134// debugPrint prints the internal attribute map of the builder for debugging.
1135// This map cannot be printed by fmt.Printf() because it has cycles.

Callers 15

setLayoutMethod · 0.95
setLayoutParamsMethod · 0.95
parseFloatsMethod · 0.95
BuildLayoutMethod · 0.80
BuildParamsMethod · 0.80
buildImagePanelFunction · 0.80
AttribCheckTableSortTypeFunction · 0.80
AttribCheckResizeBordersFunction · 0.80
AttribCheckEdgeFunction · 0.80
AttribCheckLayoutFunction · 0.80
AttribCheckAlignFunction · 0.80
AttribCheckMenuShortcutFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected