Skip to content

Commit 2bc897f

Browse files
Expose the last error message to the onBatchCopyRetry hook
Co-authored-by: Bastian Bartmann <[email protected]>
1 parent 7787aa9 commit 2bc897f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

go/logic/hooks.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ func (this *HooksExecutor) onBeforeRowCopy() error {
125125
return this.executeHooks(onBeforeRowCopy)
126126
}
127127

128-
func (this *HooksExecutor) onBatchCopyRetry() error {
129-
return this.executeHooks(onBatchCopyRetry)
128+
func (this *HooksExecutor) onBatchCopyRetry(errorMessage string) error {
129+
v := fmt.Sprintf("GH_OST_LAST_BATCH_COPY_ERROR=%s", errorMessage)
130+
return this.executeHooks(onBatchCopyRetry, v)
130131
}
131132

132133
func (this *HooksExecutor) onRowCopyComplete() error {

go/logic/migrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (this *Migrator) sleepWhileTrue(operation func() (bool, error)) error {
133133
func (this *Migrator) retryBatchCopyWithHooks(operation func() error, notFatalHint ...bool) (err error) {
134134
wrappedOperation := func() error {
135135
if err := operation(); err != nil {
136-
this.hooksExecutor.onBatchCopyRetry()
136+
this.hooksExecutor.onBatchCopyRetry(err.Error())
137137
return err
138138
}
139139
return nil

0 commit comments

Comments
 (0)