Skip to content

Commit 5473b2e

Browse files
authored
Add NewErrorAsyncJobInProgress func (#565)
1 parent 4e88e7d commit 5473b2e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

util/connection/wrappers/async/async.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (a asyncConnectionWrapper) Do(ctx context.Context, req driver.Request) (dri
6565
}
6666

6767
// Job is in progress
68-
return nil, ErrorAsyncJobInProgress{id}
68+
return nil, NewErrorAsyncJobInProgress(id)
6969
default:
7070
return resp, nil
7171
}
@@ -83,7 +83,7 @@ func (a asyncConnectionWrapper) Do(ctx context.Context, req driver.Request) (dri
8383
if asyncID := resp.Header(ArangoHeaderAsyncIDKey); len(asyncID) == 0 {
8484
return nil, errors.New("missing async key response")
8585
} else {
86-
return nil, ErrorAsyncJobInProgress{asyncID}
86+
return nil, NewErrorAsyncJobInProgress(asyncID)
8787
}
8888
default:
8989
// we expect a 202 status code only

util/connection/wrappers/async/async_errors.go

+6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ type ErrorAsyncJobInProgress struct {
4141
jobID string
4242
}
4343

44+
func NewErrorAsyncJobInProgress(jobID string) ErrorAsyncJobInProgress {
45+
return ErrorAsyncJobInProgress{
46+
jobID: jobID,
47+
}
48+
}
49+
4450
func (a ErrorAsyncJobInProgress) Error() string {
4551
return fmt.Sprintf("Job with ID %s in progress", a.jobID)
4652
}

0 commit comments

Comments
 (0)