@@ -22,7 +22,6 @@ import (
22
22
23
23
"github.com/cortexlabs/cortex/pkg/consts"
24
24
"github.com/cortexlabs/cortex/pkg/lib/aws"
25
- "github.com/cortexlabs/cortex/pkg/lib/errors"
26
25
libtime "github.com/cortexlabs/cortex/pkg/lib/time"
27
26
"github.com/cortexlabs/cortex/pkg/operator/config"
28
27
)
@@ -38,20 +37,29 @@ func getOrSetDeploymentVersion(appName string, ignoreCache bool) (string, error)
38
37
deploymentVersion := libtime .Timestamp (time .Now ())
39
38
err := config .AWS .UploadStringToS3 (deploymentVersion , deploymentVersionFileKey )
40
39
if err != nil {
41
- return "" , errors .Wrap (err , "deployment version" ) // unexpected error
40
+ if aws .IsNoSuchBucketErr (err ) {
41
+ return "" , aws .ErrorBucketInaccessible (config .AWS .Bucket )
42
+ }
43
+ return "" , err
42
44
}
43
45
return deploymentVersion , nil
44
46
}
45
47
46
48
deploymentVersion , err := config .AWS .ReadStringFromS3 (deploymentVersionFileKey )
47
49
if err != nil {
48
50
if ! aws .IsNoSuchKeyErr (err ) {
49
- return "" , errors .Wrap (err , "deployment version" ) // unexpected error
51
+ if aws .IsNoSuchBucketErr (err ) {
52
+ return "" , aws .ErrorBucketInaccessible (config .AWS .Bucket )
53
+ }
54
+ return "" , err
50
55
}
51
56
deploymentVersion = libtime .Timestamp (time .Now ())
52
57
err := config .AWS .UploadStringToS3 (deploymentVersion , deploymentVersionFileKey )
53
58
if err != nil {
54
- return "" , errors .Wrap (err , "deployment version" ) // unexpected error
59
+ if aws .IsNoSuchBucketErr (err ) {
60
+ return "" , aws .ErrorBucketInaccessible (config .AWS .Bucket )
61
+ }
62
+ return "" , err
55
63
}
56
64
}
57
65
return deploymentVersion , nil
0 commit comments