You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/internal/backend/remote-state/s3/errors.go

22 lines
392 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package s3
import (
"errors"
)
// IsA indicates whether an error matches an error type
func IsA[T error](err error) bool {
_, ok := As[T](err)
return ok
}
// As is equivalent to errors.As(), but returns the value in-line
func As[T error](err error) (T, bool) {
var as T
ok := errors.As(err, &as)
return as, ok
}