diff --git a/util/connection/wrappers/async/async.go b/util/connection/wrappers/async/async.go index a1b1a92f..7610a165 100644 --- a/util/connection/wrappers/async/async.go +++ b/util/connection/wrappers/async/async.go @@ -65,7 +65,7 @@ func (a asyncConnectionWrapper) Do(ctx context.Context, req driver.Request) (dri } // Job is in progress - return nil, ErrorAsyncJobInProgress{id} + return nil, NewErrorAsyncJobInProgress(id) default: return resp, nil } @@ -83,7 +83,7 @@ func (a asyncConnectionWrapper) Do(ctx context.Context, req driver.Request) (dri if asyncID := resp.Header(ArangoHeaderAsyncIDKey); len(asyncID) == 0 { return nil, errors.New("missing async key response") } else { - return nil, ErrorAsyncJobInProgress{asyncID} + return nil, NewErrorAsyncJobInProgress(asyncID) } default: // we expect a 202 status code only diff --git a/util/connection/wrappers/async/async_errors.go b/util/connection/wrappers/async/async_errors.go index 93eb5663..eb1f25d4 100644 --- a/util/connection/wrappers/async/async_errors.go +++ b/util/connection/wrappers/async/async_errors.go @@ -41,6 +41,12 @@ type ErrorAsyncJobInProgress struct { jobID string } +func NewErrorAsyncJobInProgress(jobID string) ErrorAsyncJobInProgress { + return ErrorAsyncJobInProgress{ + jobID: jobID, + } +} + func (a ErrorAsyncJobInProgress) Error() string { return fmt.Sprintf("Job with ID %s in progress", a.jobID) }