shithub: hugo

Download patch

ref: 53dac9a5067dfd84283a2b2d837738a63b63b596
parent: 4edb4bcc652ec9deb0335e54ca93eeb3d1a8d81b
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()