Improve error message for reading passed retention workflow history
@@ -39,7 +39,6 @@ import (
h "github.com/uber/cadence/.gen/go/history"
m "github.com/uber/cadence/.gen/go/matching"
"github.com/uber/cadence/.gen/go/replicator"
- "github.com/uber/cadence/.gen/go/shared"
gen "github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/client/history"
"github.com/uber/cadence/client/matching"
@@ -129,9 +128,8 @@ var (
errClientVersionNotSet = &gen.BadRequestError{Message: "Client version is not set on request."}
// err for archival
- errHistoryHasPassedRetentionPeriod = &gen.BadRequestError{Message: "Requested workflow history has passed retention period."}
- // the following errors represents bad user input
- errURIUpdate = &shared.BadRequestError{Message: "Cannot update existing archival URI"}
+ errHistoryNotFound = &gen.BadRequestError{Message: "Requested workflow history not found, may have passed retention period."}
+ errURIUpdate = &gen.BadRequestError{Message: "Cannot update existing archival URI"}
// err for string too long
errDomainTooLong = &gen.BadRequestError{Message: "Domain length exceeds limit."}
@@ -2425,7 +2423,7 @@ func (wh *WorkflowHandler) ListArchivedWorkflowExecutions(
return nil, wh.error(err, scope)
}
- if entry.GetConfig().VisibilityArchivalStatus != shared.ArchivalStatusEnabled {
+ if entry.GetConfig().VisibilityArchivalStatus != gen.ArchivalStatusEnabled {
return nil, wh.error(&gen.BadRequestError{Message: "Domain is not configured for visibility archival"}, scope)
}
@@ -3284,7 +3282,7 @@ func (wh *WorkflowHandler) historyArchived(ctx context.Context, request *gen.Get
return false
}
switch err.(type) {
- case *shared.EntityNotExistsError:
+ case *gen.EntityNotExistsError:
// the only case in which history is assumed to be archived is if getting mutable state returns entity not found error
return true
}
@@ -3304,7 +3302,10 @@ func (wh *WorkflowHandler) getArchivedHistory(
URIString := entry.GetConfig().HistoryArchivalURI
if URIString == "" {
- return nil, wh.error(errHistoryHasPassedRetentionPeriod, scope)
+ // if URI is empty, it means the domain has never enabled for archival.
+ // the error is not "workflow has passed retention period", because
+ // we have no way to tell if the requested workflow exists or not.
+ return nil, wh.error(errHistoryNotFound, scope)
}
URI, err := archiver.NewURI(URIString)
@@ -3328,7 +3329,7 @@ func (wh *WorkflowHandler) getArchivedHistory(
return nil, wh.error(err, scope)
}
- history := &shared.History{}
+ history := &gen.History{}
for _, batch := range resp.HistoryBatches {
history.Events = append(history.Events, batch.Events...)
}
@@ -3452,7 +3453,7 @@ func (wh *WorkflowHandler) GetDomainReplicationMessages(
// ReapplyEvents applies stale events to the current workflow and the current run
func (wh *WorkflowHandler) ReapplyEvents(
ctx context.Context,
- request *shared.ReapplyEventsRequest,
+ request *gen.ReapplyEventsRequest,
) (err error) {
defer log.CapturePanic(wh.GetLogger(), &err)
