summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/onsi/gomega/gstruct/errors
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-01-10 10:57:50 +0100
committerOndrej Fabry <ofabry@cisco.com>2019-01-10 11:05:35 +0100
commit08266e35878f198e2fa59fcfc9f0fc3a4b1dfbf5 (patch)
tree1269acfc3bf6fdd47414eb64da3ecad4865e37d6 /vendor/github.com/onsi/gomega/gstruct/errors
parent3ef6f210edcf7dd753733d46ec3f2dd5dc795b61 (diff)
Add support for string types
- strings are now generated as two fields for length and string itself - aliases are now sorted by name to prevent generating different code - dependencies are now managed by dep - binapi files are regenerated using VPP 19.01-rc0~622-g7b01e9e8 - old stats binary api has been deprecated and removed from VPP Change-Id: Ieb8515c73021339a45f407386f8e3d87dcf4469e Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'vendor/github.com/onsi/gomega/gstruct/errors')
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go72
1 files changed, 0 insertions, 72 deletions
diff --git a/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go b/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go
deleted file mode 100644
index 188492b..0000000
--- a/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package errors
-
-import (
- "fmt"
- "strings"
-
- "github.com/onsi/gomega/types"
-)
-
-// A stateful matcher that nests other matchers within it and preserves the error types of the
-// nested matcher failures.
-type NestingMatcher interface {
- types.GomegaMatcher
-
- // Returns the failures of nested matchers.
- Failures() []error
-}
-
-// An error type for labeling errors on deeply nested matchers.
-type NestedError struct {
- Path string
- Err error
-}
-
-func (e *NestedError) Error() string {
- // Indent Errors.
- indented := strings.Replace(e.Err.Error(), "\n", "\n\t", -1)
- return fmt.Sprintf("%s:\n\t%v", e.Path, indented)
-}
-
-// Create a NestedError with the given path.
-// If err is a NestedError, prepend the path to it.
-// If err is an AggregateError, recursively Nest each error.
-func Nest(path string, err error) error {
- if ag, ok := err.(AggregateError); ok {
- var errs AggregateError
- for _, e := range ag {
- errs = append(errs, Nest(path, e))
- }
- return errs
- }
- if ne, ok := err.(*NestedError); ok {
- return &NestedError{
- Path: path + ne.Path,
- Err: ne.Err,
- }
- }
- return &NestedError{
- Path: path,
- Err: err,
- }
-}
-
-// An error type for treating multiple errors as a single error.
-type AggregateError []error
-
-// Error is part of the error interface.
-func (err AggregateError) Error() string {
- if len(err) == 0 {
- // This should never happen, really.
- return ""
- }
- if len(err) == 1 {
- return err[0].Error()
- }
- result := fmt.Sprintf("[%s", err[0].Error())
- for i := 1; i < len(err); i++ {
- result += fmt.Sprintf(", %s", err[i].Error())
- }
- result += "]"
- return result
-}