mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
errors: Misc improvements
* Redo the server error template * Always add the content file context if relevant * Remove some now superflous error string matching * Move the server error template to _server/error.html * Add file context (with position) to codeblock render blocks * Improve JS build errors Fixes #9892 Fixes #9891 Fixes #9893
This commit is contained in:
@@ -116,8 +116,13 @@ func (t *transform) Transform(ctx *resources.ResourceTransformationCtx) error {
|
||||
filename = filename[len(stdinPrefix):]
|
||||
}
|
||||
|
||||
offsetMatcher := func(m herrors.LineMatcher) bool {
|
||||
return m.Offset+len(m.Line) >= start.Offset && strings.Contains(m.Line, context)
|
||||
offsetMatcher := func(m herrors.LineMatcher) int {
|
||||
if m.Offset+len(m.Line) >= start.Offset && strings.Contains(m.Line, context) {
|
||||
// We found the line, but return 0 to signal that we want to determine
|
||||
// the column from the error.
|
||||
return 0
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
return herrors.NewFileErrorFromFile(sassErr, filename, filename, hugofs.Os, offsetMatcher)
|
||||
|
Reference in New Issue
Block a user