summaryrefslogtreecommitdiffstats
path: root/resources/resource_transformers/babel
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-05-02 16:07:52 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-05-06 19:43:22 +0200
commitf2946da9e806c2bafbdd26707fe339db79bd980b (patch)
treeb5609317a861ea5f399e094e1b9287ca71dc22d1 /resources/resource_transformers/babel
parent6eea32bd6bc8e7a7dd07a8cb6a8343ae2c74aba0 (diff)
Improve error messages, esp. when the server is running
* Add file context to minifier errors when publishing * Misc fixes (see issues) * Allow custom server error template in layouts/server/error.html To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go. Fixes #9852 Fixes #9857 Fixes #9863
Diffstat (limited to 'resources/resource_transformers/babel')
-rw-r--r--resources/resource_transformers/babel/babel.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/resources/resource_transformers/babel/babel.go b/resources/resource_transformers/babel/babel.go
index a4744961e..9a9110f62 100644
--- a/resources/resource_transformers/babel/babel.go
+++ b/resources/resource_transformers/babel/babel.go
@@ -15,6 +15,7 @@ package babel
import (
"bytes"
+ "fmt"
"io"
"io/ioutil"
"os"
@@ -34,7 +35,6 @@ import (
"github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/resources"
"github.com/gohugoio/hugo/resources/resource"
- "github.com/pkg/errors"
)
// Options from https://babeljs.io/docs/en/options
@@ -141,7 +141,7 @@ func (t *babelTransformation) Transform(ctx *resources.ResourceTransformationCtx
configFile = t.rs.BaseFs.ResolveJSConfigFile(configFile)
if configFile == "" && t.options.Config != "" {
// Only fail if the user specified config file is not found.
- return errors.Errorf("babel config %q not found:", configFile)
+ return fmt.Errorf("babel config %q not found:", configFile)
}
}
@@ -203,7 +203,7 @@ func (t *babelTransformation) Transform(ctx *resources.ResourceTransformationCtx
if hexec.IsNotFound(err) {
return herrors.ErrFeatureNotAvailable
}
- return errors.Wrap(err, errBuf.String())
+ return fmt.Errorf(errBuf.String()+": %w", err)
}
content, err := ioutil.ReadAll(compileOutput)