@@ -269,10 +269,9 @@ func (m *MariaDB) InsertAssets(source string, assets []knowledge.Asset) error {
269
269
if err != nil {
270
270
if driverErr , ok := err .(* mysql.MySQLError ); ok && driverErr .Number == mysqlerr .ER_DUP_ENTRY {
271
271
// If the entry is duplicated, it's fine but we still need insert a line into assets_by_source.
272
- logrus .Debugf ("Asset duplicate %d (%s - %s) detected" , h , asset .Type , asset .Key )
273
272
} else {
274
273
tx .Rollback ()
275
- return fmt .Errorf ("Unable to insert asset %v in DB from source %s: %v" , asset , source , err )
274
+ return fmt .Errorf ("Unable to insert asset %v (%d) in DB from source %s: %v" , asset , h , source , err )
276
275
}
277
276
}
278
277
@@ -283,7 +282,7 @@ func (m *MariaDB) InsertAssets(source string, assets []knowledge.Asset) error {
283
282
// TODO(c.michaud): update the update_time?
284
283
} else {
285
284
tx .Rollback ()
286
- return fmt .Errorf ("Unable to insert binding between asset %s and source %s: %v" , asset , source , err )
285
+ return fmt .Errorf ("Unable to insert binding between asset %s (%d) and source %s: %v" , asset , h , source , err )
287
286
}
288
287
}
289
288
}
@@ -320,7 +319,7 @@ func (m *MariaDB) InsertRelations(source string, relations []knowledge.Relation)
320
319
// If the entry is duplicated, it's fine but we still need insert a line into relations_by_source.
321
320
} else {
322
321
tx .Rollback ()
323
- return fmt .Errorf ("Unable insert relation %v in DB from source %s: %v" , relation , source , err )
322
+ return fmt .Errorf ("Unable insert relation %v (%d) in DB from source %s: %v" , relation , rH , source , err )
324
323
}
325
324
}
326
325
@@ -331,7 +330,7 @@ func (m *MariaDB) InsertRelations(source string, relations []knowledge.Relation)
331
330
// TODO(c.michaud): update the update_time?
332
331
} else {
333
332
tx .Rollback ()
334
- return fmt .Errorf ("Unable to insert binding between relation %v and source %s: %v" , relation , source , err )
333
+ return fmt .Errorf ("Unable to insert binding between relation %v (%d) and source %s: %v" , relation , rH , source , err )
335
334
}
336
335
}
337
336
}
@@ -362,7 +361,7 @@ func (m *MariaDB) RemoveAssets(source string, assets []knowledge.Asset) error {
362
361
h , sourceID )
363
362
if err != nil {
364
363
tx .Rollback ()
365
- return fmt .Errorf ("Unable to remove binding between asset %v and source %s: %v" , asset , source , err )
364
+ return fmt .Errorf ("Unable to remove binding between asset %v (%d) and source %s: %v" , asset , h , source , err )
366
365
}
367
366
368
367
_ , err = tx .ExecContext (context .Background (),
@@ -372,7 +371,7 @@ func (m *MariaDB) RemoveAssets(source string, assets []knowledge.Asset) error {
372
371
h , h )
373
372
if err != nil {
374
373
tx .Rollback ()
375
- return fmt .Errorf ("Unable to remove asset %v from source %s: %v" , asset , source , err )
374
+ return fmt .Errorf ("Unable to remove asset %v (%d) from source %s: %v" , asset , h , source , err )
376
375
}
377
376
378
377
}
@@ -403,7 +402,7 @@ func (m *MariaDB) RemoveRelations(source string, relations []knowledge.Relation)
403
402
rH , sourceID )
404
403
if err != nil {
405
404
tx .Rollback ()
406
- return fmt .Errorf ("Unable to remove binding between relation %v and source %s: %v" , relation , source , err )
405
+ return fmt .Errorf ("Unable to remove binding between relation %v (%d) and source %s: %v" , relation , rH , source , err )
407
406
}
408
407
409
408
_ , err = tx .ExecContext (context .Background (),
@@ -413,7 +412,7 @@ func (m *MariaDB) RemoveRelations(source string, relations []knowledge.Relation)
413
412
rH , rH )
414
413
if err != nil {
415
414
tx .Rollback ()
416
- return fmt .Errorf ("Unable to remove relation %v from source %s: %v" , relation , source , err )
415
+ return fmt .Errorf ("Unable to remove relation %v (%d) from source %s: %v" , relation , rH , source , err )
417
416
}
418
417
}
419
418
0 commit comments