tyco
January 31, 2025, 8:48pm
1
How to correct the error?
{{- $data := "" }}
{{- $URL := "https://example.com/test.json" }}
{{- with resources.GetRemote $URL }}
{{- with .Err }}
{{- errorf "%s" . }}
{{- else }}
{{- $data = . | transform.Unmarshal }}
{{- end }}
{{- else }}
{{- errorf "Unable to get remote resource %q" $URL }}
{{- end -}}
$ hugo env
hugo v0.141.0-e7bd51698e5c3778a86003018702b1a7dcb9559a+extended linux/amd64 BuildDate=2025-01-16T13:11:18Z VendorInfo=gohugoio
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.23.4"
github.com/sass/libsass="3.6.6"
github.com/webmproject/libwebp="v1.3.2"
irkode
January 31, 2025, 8:56pm
3
what do you think of adding a pointer at the beginning of the GetRemote docs page. something like
new in 0.141.1
from 141 you have to use with try
to capture erros. see details → try page
Please don’t be offended, but I dislike stuff like that because it ages… we need to remember (and be motivated) to remove it later.
I’ll see about modifying our “new-in” shortcode so that it accepts content. That shortcode throws a warning after a certain number of releases, reminding us to remove it.
1 Like
irkode
January 31, 2025, 10:08pm
5
i like that interpretation of my something like
system
Closed
February 3, 2025, 4:08am
7
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.