@@ -289,9 +289,11 @@ func (p PizzaOvenServer) processRepository(repoURL string) error {
289289 p .Logger .Debugf ("No repo found in db. Inserting repo: %s" , insight .RepoURLSource )
290290 repoID , err = p .PizzaOven .InsertRepository (insight )
291291 if err != nil {
292+ p .Logger .Errorf ("Failed to insert repository %s: %s" , insight .RepoURLSource , err .Error ())
292293 return err
293294 }
294295 } else {
296+ p .Logger .Errorf ("Failed to fetch repository ID: %s" , err .Error ())
295297 return err
296298 }
297299 }
@@ -301,6 +303,7 @@ func (p PizzaOvenServer) processRepository(repoURL string) error {
301303 // Use the configured git provider to get the repo
302304 providedRepo , err := p .PizzaGitProvider .FetchRepo (insight .RepoURLSource )
303305 if err != nil {
306+ p .Logger .Error ("Failed to fetch repository %s: %s" , insight .RepoURLSource , err .Error ())
304307 return err
305308 }
306309 defer providedRepo .Done ()
@@ -310,12 +313,14 @@ func (p PizzaOvenServer) processRepository(repoURL string) error {
310313 p .Logger .Debugf ("Inspecting the head of the git repo: %s" , insight .RepoURLSource )
311314 ref , err := gitRepo .Head ()
312315 if err != nil {
316+ p .Logger .Errorf ("Could not find head of the git repo %s: %s" , insight .RepoURLSource , err .Error ())
313317 return err
314318 }
315319
316320 p .Logger .Debugf ("Getting last commit in DB: %s" , insight .RepoURLSource )
317321 latestCommitDate , err := p .PizzaOven .GetLastCommit (repoID )
318322 if err != nil {
323+ p .Logger .Errorf ("Could not fetch the latest commit date in %s: %s" , insight .RepoURLSource , err .Error ())
319324 return err
320325 }
321326
@@ -334,6 +339,7 @@ func (p PizzaOvenServer) processRepository(repoURL string) error {
334339 p .Logger .Debugf ("Getting commit iterator with git log options: %v" , gitLogOptions )
335340 authorIter , err := gitRepo .Log (& gitLogOptions )
336341 if err != nil {
342+ p .Logger .Errorf ("Failed to retrieve commit iterator: %s" , err .Error ())
337343 return err
338344 }
339345
@@ -346,6 +352,7 @@ func (p PizzaOvenServer) processRepository(repoURL string) error {
346352 p .Logger .Debugf ("Using temporary db table for commit authors: %s" , tmpTableName )
347353 authorTxn , authorStmt , err := p .PizzaOven .PrepareBulkAuthorInsert (tmpTableName )
348354 if err != nil {
355+ p .Logger .Errorf ("Failed to prepare the bulk author insert process: %s" , err .Error ())
349356 return err
350357 }
351358
@@ -381,36 +388,42 @@ func (p PizzaOvenServer) processRepository(repoURL string) error {
381388 })
382389 })
383390 if err != nil {
391+ p .Logger .Errorf ("Failed to insert author: %s" , err .Error ())
384392 return err
385393 }
386394
387395 // Resolve, execute, and pivot the bulk author transaction
388396 err = p .PizzaOven .ResolveTransaction (authorTxn , authorStmt )
389397 if err != nil {
398+ p .Logger .Errorf ("Failed to resolve bulk author transaction: %s" , err .Error ())
390399 return err
391400 }
392401
393402 err = p .PizzaOven .PivotTmpTableToAuthorsTable (tmpTableName )
394403 if err != nil {
404+ p .Logger .Errorf ("Failed to pivot the temporary authors table: %s" , err .Error ())
395405 return err
396406 }
397407
398408 // Re-query the database for author email ids based on the unique list of
399409 // author emails that have just been committed
400410 authorEmailIDMap , err := p .PizzaOven .GetAuthorIDs (uniqueAuthorEmails )
401411 if err != nil {
412+ p .Logger .Errorf ("Failed to create the author-email/id map: %s" , err .Error ())
402413 return err
403414 }
404415
405416 // Rebuild the iterator from the start using the same options
406417 commitIter , err := gitRepo .Log (& gitLogOptions )
407418 if err != nil {
419+ p .Logger .Errorf ("Failed to rebuild the commit iterator: %s" , err .Error ())
408420 return err
409421 }
410422
411423 // Get ready for the commit bulk action
412424 commitTxn , commitStmt , err := p .PizzaOven .PrepareBulkCommitInsert ()
413425 if err != nil {
426+ p .Logger .Errorf ("Failed to prepare bulk commit insert process: %s" , err .Error ())
414427 return err
415428 }
416429
@@ -426,18 +439,21 @@ func (p PizzaOvenServer) processRepository(repoURL string) error {
426439 p .Logger .Debugf ("Inspecting commit: %s %s %s" , i .AuthorEmail , i .Hash , i .Date )
427440 err = p .PizzaOven .InsertCommit (commitStmt , i , authorEmailIDMap [i .AuthorEmail ], repoID )
428441 if err != nil {
442+ p .Logger .Errorf ("Failed to insert commit: %s" , err .Error ())
429443 return err
430444 }
431445
432446 return nil
433447 })
434448 if err != nil {
449+ p .Logger .Errorf ("Failed to insert commit: %s" , err .Error ())
435450 return err
436451 }
437452
438453 // Execute and resolve the bulk commit insert
439454 err = p .PizzaOven .ResolveTransaction (commitTxn , commitStmt )
440455 if err != nil {
456+ p .Logger .Errorf ("Could not resolve bulk commit insert transaction %v" , err .Error ())
441457 return err
442458 }
443459
0 commit comments