Skip to content

Commit

Permalink
batch serviceusage reads (#255)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored and danawillow committed Nov 11, 2019
1 parent 4e2e755 commit f860135
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion google/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"log"
"sync"
"time"

"github.com/hashicorp/errwrap"
)

const defaultBatchSendIntervalSec = 10
Expand Down Expand Up @@ -154,7 +156,8 @@ func (b *RequestBatcher) SendRequestWithTimeout(batchKey string, request *BatchR
select {
case resp := <-respCh:
if resp.err != nil {
return nil, fmt.Errorf("Batch %q for request %q returned error: %v", batchKey, request.DebugId, resp.err)
// use wrapf so we can potentially extract the original error type
return nil, errwrap.Wrapf(fmt.Sprintf("Batch %q for request %q returned error: {{err}}", batchKey, request.DebugId), resp.err)
}
return resp.body, nil
case <-ctx.Done():
Expand Down

0 comments on commit f860135

Please sign in to comment.