Skip to content

Commit

Permalink
Merge pull request #283 from Shopify/report-error-copydb-initialize
Browse files Browse the repository at this point in the history
report error to the callback if ferry initialization fails in copydb
  • Loading branch information
Manan Maniyar committed May 14, 2021
2 parents f6b7173 + a596933 commit 43a8894
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions copydb/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,15 @@ func main() {

err = ferry.Initialize()
if err != nil {
// This is not a good idea to reach deep within ferry from copydb. The entire ErrorHandler needs
// refactoring which is defined in this issue - https://github.com/Shopify/ghostferry/issues/284
ferry.Ferry.ErrorHandler.ReportError("ferry.initialize", err)
errorAndExit(fmt.Sprintf("failed to initialize ferry: %v", err))
}

err = ferry.Start()
if err != nil {
ferry.Ferry.ErrorHandler.ReportError("ferry.start", err)
errorAndExit(fmt.Sprintf("failed to start ferry: %v", err))
}

Expand All @@ -122,6 +126,7 @@ func main() {
if config.StateToResumeFrom == nil {
err = ferry.CreateDatabasesAndTables()
if err != nil {
ferry.Ferry.ErrorHandler.ReportError("ferry.createDatabasesAndTables", err)
errorAndExit(fmt.Sprintf("failed to create databases and tables: %v", err))
}
}
Expand Down

0 comments on commit 43a8894

Please sign in to comment.