-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Description
So, what I propose here is doable (I think), but we should think hard and long before we decide if and how.
I was reminded of this in
https://discourse.gohugo.io/t/catch-exception-for-transform-unmarshal-csv/37965/10
We currently have a special case for resources.GetRemote which, when it fails, returns a "Resource proxy" with .Err set.
My idea would be to do something like this:
{{ $g := "hello = \"Hello Hugo\"" | transform.Unmarshal | try }}
{{ with $g.Err }}
// print error (or something)
{{ else }}
{{ $resource := $g.Value }}
{{ end }}davidsneighbour, xandermann, pamubay, ajboni, BBaoVanC and 10 moredavidsneighbour, michaeltlombardi and razonyangdavidsneighbour, plasterbrain, michaeltlombardi and razonyang