akamai: replacing error assertions with errors.As (#5127)
errors.As checks for a specific error in a wrapped error chain (see https://golang.org/pkg/errors/#As) as opposed to asserting that an error is of a specific type. Part of #5010
This commit is contained in:
parent
9712d21aeb
commit
ed67efaa78
|
@ -254,7 +254,8 @@ func (cpc *CachePurgeClient) purgeBatch(urls []string) error {
|
|||
|
||||
err := cpc.purge(urls)
|
||||
if err != nil {
|
||||
if _, ok := err.(errFatal); ok {
|
||||
var errorFatal errFatal
|
||||
if errors.As(err, &errorFatal) {
|
||||
cpc.purges.WithLabelValues("fatal failure").Inc()
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue