resource: Improve error processing error message - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 53dac9a5067dfd84283a2b2d837738a63b63b596
DIR parent 4edb4bcc652ec9deb0335e54ca93eeb3d1a8d81b
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Tue, 13 Feb 2018 09:14:44 +0100
resource: Improve error processing error message
Diffstat:
M resource/image.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
DIR diff --git a/resource/image.go b/resource/image.go
@@ -223,11 +223,14 @@ func (i *Image) doWithImageConfig(action, spec string, f func(src image.Image, c
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 @@ func (i *Image) doWithImageConfig(action, spec string, f func(src image.Image, c
converted, err := f(src, conf)
if err != nil {
- return ci, err
+ return ci, &os.PathError{Op: errOp, Path: errPath, Err: err}
}
b := converted.Bounds()