pagination error types
diff --git a/pagination/single.go b/pagination/single.go
index 2be2ff6..4251d64 100644
--- a/pagination/single.go
+++ b/pagination/single.go
@@ -3,6 +3,8 @@
import (
"fmt"
"reflect"
+
+ "github.com/gophercloud/gophercloud"
)
// SinglePageBase may be embedded in a Page that contains all of the results from an operation at once.
@@ -13,11 +15,15 @@
return "", nil
}
+// IsEmpty satisifies the IsEmpty method of the Page interface
func (current SinglePageBase) IsEmpty() (bool, error) {
if b, ok := current.Body.([]interface{}); ok {
return len(b) == 0, nil
}
- return true, fmt.Errorf("Error while checking if SinglePageBase was empty: expected []interface type for Body bot got %+v", reflect.TypeOf(current.Body))
+ err := gophercloud.ErrUnexpectedType{}
+ err.Expected = "[]interface{}"
+ err.Actual = fmt.Sprintf("%v", reflect.TypeOf(current.Body))
+ return true, err
}
// GetBody returns the single page's body. This method is needed to satisfy the