pagination error types
diff --git a/pagination/marker.go b/pagination/marker.go
index 26b9d97..52e53ba 100644
--- a/pagination/marker.go
+++ b/pagination/marker.go
@@ -3,6 +3,8 @@
import (
"fmt"
"reflect"
+
+ "github.com/gophercloud/gophercloud"
)
// MarkerPage is a stricter Page interface that describes additional functionality required for use with NewMarkerPager.
@@ -38,11 +40,15 @@
return currentURL.String(), nil
}
+// IsEmpty satisifies the IsEmpty method of the Page interface
func (current MarkerPageBase) IsEmpty() (bool, error) {
if b, ok := current.Body.([]interface{}); ok {
return len(b) == 0, nil
}
- return true, fmt.Errorf("Error while checking if MarkerPageBase 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 linked page's body. This method is needed to satisfy the