mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
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:
@@ -511,5 +511,5 @@ func (configLoader) loadSiteConfig(cfg config.Provider) (scfg SiteConfig, err er
|
||||
}
|
||||
|
||||
func (l configLoader) wrapFileError(err error, filename string) error {
|
||||
return herrors.NewFileErrorFromFile(err, filename, filename, l.Fs, nil)
|
||||
return herrors.NewFileErrorFromFile(err, filename, l.Fs, nil)
|
||||
}
|
||||
|
@@ -968,7 +968,7 @@ func (h *HugoSites) errWithFileContext(err error, f source.File) error {
|
||||
}
|
||||
realFilename := fim.Meta().Filename
|
||||
|
||||
return herrors.NewFileErrorFromFile(err, realFilename, realFilename, h.SourceSpec.Fs.Source, nil)
|
||||
return herrors.NewFileErrorFromFile(err, realFilename, h.SourceSpec.Fs.Source, nil)
|
||||
|
||||
}
|
||||
|
||||
|
@@ -588,7 +588,7 @@ func (p *pageState) wrapError(err error) error {
|
||||
}
|
||||
}
|
||||
|
||||
return herrors.NewFileErrorFromFile(err, filename, filename, p.s.SourceSpec.Fs.Source, herrors.NopLineMatcher)
|
||||
return herrors.NewFileErrorFromFile(err, filename, p.s.SourceSpec.Fs.Source, herrors.NopLineMatcher)
|
||||
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ func (p *pageState) outputFormat() (f output.Format) {
|
||||
|
||||
func (p *pageState) parseError(err error, input []byte, offset int) error {
|
||||
pos := p.posFromInput(input, offset)
|
||||
return herrors.NewFileError(p.File().Filename(), err).UpdatePosition(pos)
|
||||
return herrors.NewFileError(err, p.File().Filename()).UpdatePosition(pos)
|
||||
}
|
||||
|
||||
func (p *pageState) pathOrTitle() string {
|
||||
|
@@ -298,7 +298,7 @@ func renderShortcode(
|
||||
var err error
|
||||
tmpl, err = s.TextTmpl().Parse(templName, templStr)
|
||||
if err != nil {
|
||||
fe := herrors.NewFileError(p.File().Filename(), err)
|
||||
fe := herrors.NewFileError(err, p.File().Filename())
|
||||
pos := fe.Position()
|
||||
pos.LineNumber += p.posOffset(sc.pos).LineNumber
|
||||
fe = fe.UpdatePosition(pos)
|
||||
@@ -391,7 +391,7 @@ func renderShortcode(
|
||||
result, err := renderShortcodeWithPage(s.Tmpl(), tmpl, data)
|
||||
|
||||
if err != nil && sc.isInline {
|
||||
fe := herrors.NewFileError(p.File().Filename(), err)
|
||||
fe := herrors.NewFileError(err, p.File().Filename())
|
||||
pos := fe.Position()
|
||||
pos.LineNumber += p.posOffset(sc.pos).LineNumber
|
||||
fe = fe.UpdatePosition(pos)
|
||||
|
Reference in New Issue
Block a user