blob: 065e652c9aac6771c82272490865e2267d84f2c2 [file] [log] [blame] [edit]
// 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
}