package resource

import (
	"fmt"

	"github.com/pingcap/test-infra/common/model/resource"
)

var (
	_ error = ErrorResourceNotFound{}
)

// ErrorResourceNotFound means the test resource not found
type ErrorResourceNotFound struct {
	resource.ResourceHandle
}

func (e ErrorResourceNotFound) Error() string {
	return fmt.Sprintf("resource [%s/%s] not found", e.Testbed, e.Name)
}

func IsResourceNotFoundError(err error) bool {
	_, ok := err.(ErrorResourceNotFound)
	return ok
}
