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:
Samantha 2020-10-14 15:30:28 -07:00 committed by GitHub
parent 9712d21aeb
commit ed67efaa78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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
}