Skip to content

Commit 389c9a9

Browse files
committed
small updates such as additional logging
1 parent cab89ca commit 389c9a9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

engine/plugins/api/gleif/fuzzy.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (fc *fuzzyCompletions) check(e *et.Event) error {
3434
}
3535

3636
since, err := support.TTLStartTime(e.Session.Config(),
37-
string(oam.Organization), string(oam.Organization), fc.plugin.name)
37+
string(oam.Organization), string(oam.Identifier), fc.plugin.name)
3838
if err != nil {
3939
return err
4040
}
@@ -115,10 +115,12 @@ func (fc *fuzzyCompletions) query(e *et.Event, orgent *dbt.Entity) *dbt.Entity {
115115
} `json:"relationships"`
116116
} `json:"data"`
117117
}
118-
if err := json.Unmarshal([]byte(resp.Body), &result); err != nil || len(result.Data) == 0 {
118+
if err := json.Unmarshal([]byte(resp.Body), &result); err != nil {
119119
msg := fmt.Sprintf("Failed to unmarshal the LEI record for %s: %s", o.Name, err)
120120
e.Session.Log().Error(msg, slog.Group("plugin", "name", fc.plugin.name, "handler", fc.name))
121121
return nil
122+
} else if len(result.Data) == 0 {
123+
return nil
122124
}
123125

124126
var names []string

engine/plugins/api/gleif/org_lei.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ func (g *gleif) updateOrgFromLEIRecord(e *et.Event, orgent *dbt.Entity, lei *lei
9999
_ = g.addIdentifiersToOrg(e, orgent, general.MarketIDCode, lei.Attributes.MIC, conf)
100100
_ = g.addIdentifiersToOrg(e, orgent, general.OpenCorpID, []string{lei.Attributes.OCID}, conf)
101101
_ = g.addIdentifiersToOrg(e, orgent, general.SPGlobalCompanyID, lei.Attributes.SPGlobal, conf)
102-
_, _ = e.Session.Cache().CreateEntity(orgent)
102+
103+
// update the Organization
104+
if _, err := e.Session.Cache().CreateEntity(orgent); err != nil {
105+
msg := fmt.Sprintf("failed to update the Organization asset for %s: %s", o.Name, err)
106+
e.Session.Log().Error(msg, slog.Group("plugin", "name", g.name, "handler", g.name))
107+
}
103108
}
104109

105110
func (g *gleif) addAddress(e *et.Event, orgent *dbt.Entity, rel oam.Relation, addr string, conf int) error {

0 commit comments

Comments
 (0)