postcss: Fix import error handling

Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import.

You can work around this by either:

* Use url imports or imports with media queries.
* Set `skipInlineImportsNotFound=true` in the options

Also get the argument order in the different NewFileError* funcs in line.

Fixes #9895
This commit is contained in:
Bjørn Erik Pedersen 2022-05-14 15:51:04 +02:00
parent c2fa0a3320
commit 4b189d8fd9
20 changed files with 159 additions and 43 deletions

View file

@ -30,7 +30,7 @@ func TestNewFileError(t *testing.T) {
c := qt.New(t)
fe := NewFileError("foo.html", errors.New("bar"))
fe := NewFileError(errors.New("bar"), "foo.html")
c.Assert(fe.Error(), qt.Equals, `"foo.html:1:1": bar`)
lines := ""
@ -70,7 +70,7 @@ func TestNewFileErrorExtractFromMessage(t *testing.T) {
{errors.New(`execute of template failed: template: index.html:2:5: executing "index.html" at <partial "foo.html" .>: error calling partial: "/layouts/partials/foo.html:3:6": execute of template failed: template: partials/foo.html:3:6: executing "partials/foo.html" at <.ThisDoesNotExist>: can't evaluate field ThisDoesNotExist in type *hugolib.pageStat`), 0, 2, 5},
} {
got := NewFileError("test.txt", test.in)
got := NewFileError(test.in, "test.txt")
errMsg := qt.Commentf("[%d][%T]", i, got)