@@ -22,7 +22,6 @@ import (
2222
2323 "github.com/cortexlabs/cortex/pkg/consts"
2424 "github.com/cortexlabs/cortex/pkg/lib/aws"
25- "github.com/cortexlabs/cortex/pkg/lib/errors"
2625 libtime "github.com/cortexlabs/cortex/pkg/lib/time"
2726 "github.com/cortexlabs/cortex/pkg/operator/config"
2827)
@@ -38,20 +37,29 @@ func getOrSetDeploymentVersion(appName string, ignoreCache bool) (string, error)
3837 deploymentVersion := libtime .Timestamp (time .Now ())
3938 err := config .AWS .UploadStringToS3 (deploymentVersion , deploymentVersionFileKey )
4039 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
4244 }
4345 return deploymentVersion , nil
4446 }
4547
4648 deploymentVersion , err := config .AWS .ReadStringFromS3 (deploymentVersionFileKey )
4749 if err != nil {
4850 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
5055 }
5156 deploymentVersion = libtime .Timestamp (time .Now ())
5257 err := config .AWS .UploadStringToS3 (deploymentVersion , deploymentVersionFileKey )
5358 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
5563 }
5664 }
5765 return deploymentVersion , nil
0 commit comments