Feature request: better error messages for resources.Get/resources.ToCSS

I have these three lines in one of my templates. They work just fine:

{{ $sassOptions := (dict "outputStyle" "compressed" "enableSourceMap" true) -}}
{{ $styles := resources.Get "CSS/all.scss" | resources.ToCSS $sassOptions | fingerprint -}}
<link rel='stylesheet' href='{{ $styles.RelPermalink }}' integrity='{{ $styles.Data.Integrity }}'>

Unfortunately, it took me a bit to get these three lines right. For a while, I accidentally referred to “CSS/main.scss”, which doesn’t exist. The three lines looked like this:

{{ $sassOptions := (dict "outputStyle" "compressed" "enableSourceMap" true) -}}
{{ $styles := resources.Get "CSS/main.scss" | resources.ToCSS $sassOptions | fingerprint -}}
<link rel='stylesheet' href='{{ $styles.RelPermalink }}' integrity='{{ $styles.Data.Integrity }}'>

This gave me the following error message:

ERROR 2020/01/23 19:25:11 Failed to render pages: render of "home" failed: "/Users/comatoast/Projects/hugo-boilerplate/layouts/index.html:7:59": execute of template failed: template: index.html:7:59: executing "index.html" at <resources.ToCSS>: error calling ToCSS: type map[string]interface {} not supported in Resource transformations

…which made me think I’d screwed up by passing $sassOptions to resources.ToCSS. This was…not my problem.

Would it be possible to improve the error message for resources.ToCSS?

What would you like it to say? This is because resources.ToCSS is a different function.

You could always do:

{{with $styles}}
<link rel='stylesheet' href='{{.RelPermalink}}' integrity='{{.Data.Integrity}}'>
{{else}}
{{errorf "Your error messsage"}}
{{end}}