shithub: hugo

Download patch

ref: 2851af0225cdf6c4e47058979cd22949ed6d1fc0
parent: 08521dac8323403933a8fd11acfd16930af5f17d
author: Bjørn Erik Pedersen <[email protected]>
date: Tue Feb 13 04:14:44 EST 2018

resource: Improve error processing error message

--- a/resource/image.go
+++ b/resource/image.go
@@ -223,11 +223,14 @@
 	return i.spec.imageCache.getOrCreate(i, key, func(resourceCacheFilename string) (*Image, error) {
 		ci := i.clone()
 
+		errOp := action
+		errPath := i.AbsSourceFilename()
+
 		ci.setBasePath(conf)
 
 		src, err := i.decodeSource()
 		if err != nil {
-			return nil, err
+			return nil, &os.PathError{Op: errOp, Path: errPath, Err: err}
 		}
 
 		if conf.Rotate != 0 {
@@ -237,7 +240,7 @@
 
 		converted, err := f(src, conf)
 		if err != nil {
-			return ci, err
+			return ci, &os.PathError{Op: errOp, Path: errPath, Err: err}
 		}
 
 		b := converted.Bounds()