DebugPrint should handle the case where the resource cannot be found

We print "unknown resource" instead

Issue #22
This commit is contained in:
Justin Santa Barbara 2016-07-06 00:40:51 -04:00
parent 7b57329f34
commit 2f84573e2b
1 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,11 @@ func DebugPrint(o interface{}) string {
if o == nil {
return "<nil>"
}
if rh, ok := o.(*ResourceHolder); ok {
if rh.Resource == nil {
return fmt.Sprintf("unknown resource %q", rh.Name)
}
}
if resource, ok := o.(Resource); ok {
s, err := ResourceAsString(resource)
if err != nil {