From 4b189d8fd93d3fa326b31d451d5594c917e6c714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 14 May 2022 15:51:04 +0200 Subject: 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 --- tpl/tplimpl/template.go | 2 +- tpl/tplimpl/template_errors.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tpl') diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go index 25f7957fd..42a324e9c 100644 --- a/tpl/tplimpl/template.go +++ b/tpl/tplimpl/template.go @@ -554,7 +554,7 @@ func (t *templateHandler) addFileContext(templ tpl.Template, inerr error) error } defer f.Close() - fe := herrors.NewFileError(info.realFilename, inErr) + fe := herrors.NewFileError(inErr, info.realFilename) fe.UpdateContent(f, lineMatcher) if !fe.ErrorContext().Position.IsValid() { diff --git a/tpl/tplimpl/template_errors.go b/tpl/tplimpl/template_errors.go index 751b4ddbc..a444899aa 100644 --- a/tpl/tplimpl/template_errors.go +++ b/tpl/tplimpl/template_errors.go @@ -53,7 +53,7 @@ func (t templateInfo) resolveType() templateType { func (info templateInfo) errWithFileContext(what string, err error) error { err = fmt.Errorf(what+": %w", err) - fe := herrors.NewFileError(info.realFilename, err) + fe := herrors.NewFileError(err, info.realFilename) f, err := info.fs.Open(info.filename) if err != nil { return err -- cgit v1.2.3