mirror of https://github.com/docker/docs.git
releaser(aws): remove type assertion on errors
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
fbf879c97f
commit
b759ac65bb
|
@ -4,6 +4,7 @@ import (
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -143,13 +144,14 @@ func (s *AwsCloudfrontUpdateCmd) Run() error {
|
||||||
FunctionName: aws.String(s.Function),
|
FunctionName: aws.String(s.Function),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if aerr, ok := err.(awserr.Error); ok && aerr.Code() != lambda.ErrCodeResourceNotFoundException {
|
var aerr awserr.Error
|
||||||
|
if errors.As(err, &aerr) && aerr.Code() != lambda.ErrCodeResourceNotFoundException {
|
||||||
return fmt.Errorf("cannot find lambda function %q: %w", s.Function, err)
|
return fmt.Errorf("cannot find lambda function %q: %w", s.Function, err)
|
||||||
}
|
}
|
||||||
_, err = svc.CreateFunction(&lambda.CreateFunctionInput{
|
_, err = svc.CreateFunction(&lambda.CreateFunctionInput{
|
||||||
FunctionName: aws.String(s.Function),
|
FunctionName: aws.String(s.Function),
|
||||||
})
|
})
|
||||||
if aerr, ok := err.(awserr.Error); ok && aerr.Code() != lambda.ErrCodeResourceConflictException {
|
if errors.As(err, &aerr) && aerr.Code() != lambda.ErrCodeResourceConflictException {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue