@@ -3,9 +3,9 @@ package reflector
33import (
44 "bytes"
55 "context"
6- er "errors"
76 "fmt"
87 "io"
8+ "net/http"
99 "os"
1010 "strings"
1111 "time"
@@ -14,8 +14,7 @@ import (
1414 "github.com/aws/aws-sdk-go-v2/config"
1515 "github.com/aws/aws-sdk-go-v2/feature/s3/manager"
1616 "github.com/aws/aws-sdk-go-v2/service/s3"
17- "github.com/aws/aws-sdk-go-v2/service/s3/types"
18- "github.com/aws/smithy-go"
17+ "github.com/aws/aws-sdk-go/aws/awserr"
1918 gzip "github.com/klauspost/pgzip"
2019
2120 "github.com/segmentio/ctlstore/pkg/errs"
@@ -61,14 +60,11 @@ func (d *S3Downloader) DownloadTo(w io.Writer) (n int64, err error) {
6160 stats .Observe ("snapshot_download_time" , time .Now ().Sub (start ))
6261
6362 if err != nil {
64- var apiErr smithy.APIError
65- if er .As (err , & apiErr ) {
66- switch apiErr .(type ) {
67- case * types.NotFound :
68- if d .StartOverOnNotFound {
69- // don't bother retrying. we'll start with a fresh ldb.
70- return - 1 , errors .WithTypes (errors .Wrap (err , "get s3 data" ), errs .ErrTypePermanent )
71- }
63+ switch err := err .(type ) {
64+ case awserr.RequestFailure :
65+ if d .StartOverOnNotFound && err .StatusCode () == http .StatusNotFound {
66+ // don't bother retrying. we'll start with a fresh ldb.
67+ return - 1 , errors .WithTypes (errors .Wrap (err , "get s3 data" ), errs .ErrTypePermanent )
7268 }
7369 }
7470 // retry
0 commit comments