Skip to content

Commit

Permalink
Improve SassError.Error()
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Dec 28, 2020
1 parent c6a216c commit 35a132a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion transpiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"path"
"strings"

"os"
Expand Down Expand Up @@ -110,7 +111,9 @@ type SassError struct {
}

func (e SassError) Error() string {
return e.Message
span := e.Span
file := path.Clean(strings.TrimPrefix(span.Url, "file:"))
return fmt.Sprintf("file: %q, context: %q: %s", file, span.Context, e.Message)
}

// Close closes the stream to the embedded Dart Sass Protocol, shutting it down.
Expand Down

0 comments on commit 35a132a

Please sign in to comment.