Repository: gohugoio/hugo (language: go)

Issue:
Error messages for dart-sass permissions errors should be more descriptive
Related to https://discourse.gohugo.io/t/error-using-dart-sass-fails-to-transform/37623

Via @bep:

> We should be able to create a better error message in that, I assume, common error situation.



Discussion / hints:

Fix patch:
diff --git a/resources/resource_transformers/tocss/dartsass/client.go b/resources/resource_transformers/tocss/dartsass/client.go
index c2a572d9bb5..b5d05b30b41 100644
--- a/resources/resource_transformers/tocss/dartsass/client.go
+++ b/resources/resource_transformers/tocss/dartsass/client.go
@@ -16,6 +16,7 @@
 package dartsass
 
 import (
+	"fmt"
 	"io"
 
 	"github.com/gohugoio/hugo/helpers"
@@ -77,6 +78,9 @@ func (c *Client) toCSS(args godartsass.Args, src io.Reader) (godartsass.Result,
 
 	res, err := c.transpiler.Execute(args)
 	if err != nil {
+		if err.Error() == "unexpected EOF" {
+			return res, fmt.Errorf("got unexpected EOF when executing %q. The user running hugo must have read and execute permissions on this program. With execute permissions only, this error is thrown.", dartSassEmbeddedBinaryName)
+		}
 		return res, err
 	}
 


Test patch: