forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
31 lines (25 loc) · 878 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package errors
import "fmt"
// NewSuiteOutOfBoundsError returns a new SuiteOutOfBounds error for the given suite name
func NewSuiteOutOfBoundsError(name string) error {
return &suiteOutOfBoundsError{
suiteName: name,
}
}
// suiteOutOfBoundsError describes the failure to place a test suite into a test suite tree because the suite
// in question is not a child of any suite in the tree
type suiteOutOfBoundsError struct {
suiteName string
}
func (e *suiteOutOfBoundsError) Error() string {
return fmt.Sprintf("the test suite %q could not be placed under any existing roots in the tree", e.suiteName)
}
// IsSuiteOutOfBoundsError determines if the given error was raised because a suite could not be placed
// in the test suite tree
func IsSuiteOutOfBoundsError(err error) bool {
if err == nil {
return false
}
_, ok := err.(*suiteOutOfBoundsError)
return ok
}