MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / diffError

Function diffError

Source/componentdiff.go:400–421  ·  view source on GitHub ↗
(path string, errorA ComponentDefinitionError, errorB ComponentDefinitionError)

Source from the content-addressed store, hash-verified

398
399
400func diffError(path string, errorA ComponentDefinitionError, errorB ComponentDefinitionError) ([]ComponentDiffAttributeChange, error) {
401 changes := make([]ComponentDiffAttributeChange, 0)
402
403 pathA := path + "/error[@name='" + errorA.Name + "']"
404 if (errorA.Code != errorB.Code) {
405 var change ComponentDiffAttributeChange
406 change.Path = pathA + "/code"
407 change.OldValue = string(errorA.Code)
408 change.NewValue = string(errorB.Code)
409 changes = append(changes, change)
410 }
411
412 if (errorA.Description != errorB.Description) {
413 var change ComponentDiffAttributeChange
414 change.Path = pathA + "/description"
415 change.OldValue = errorA.Description
416 change.NewValue = errorB.Description
417 changes = append(changes, change)
418 }
419
420 return changes, nil
421}
422
423func diffErrors(path string, errorsA[] ComponentDefinitionError, errorsB[] ComponentDefinitionError) ([]ComponentDiffElementAdd, []ComponentDiffElementRemove, []ComponentDiffAttributeChange, error) {
424 changes := make([]ComponentDiffAttributeChange, 0)

Callers 1

diffErrorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected