New try-catch on older version of Hugo

Hello!

I noticed that, in Hugo 0.141.0, there is a new try-catch. In an add-on I use for my blog, updating Hugo breaks the build because the mentioned add-on uses the old try-catch.

In this PR I’m working with another user that experienced the same thing, and we’re thinking about how to keep compatibility with older versions of Hugo using the new try-catch.

Has anyone dealt with this?

Thank you in advance.

Cheers!

I had the same dilemma with one of my themes, and I concluded that it wasn’t possible. Go’s template parser fails if you try to use a keyword/function that’s not available in the current running version.

This is unfortunate, and I’m pondering on a way to improve this, but I’m not sure how that would work.

1 Like

I was afraid of that.

In the end, the maintainer decided to tag the new version with the new try-catch and specifying the minimum Hugo version required.

Thank you @bep !

don’t take that too serious :wink:

and now a killer feature in 0.143…might help to get more themes updated

fe.Add .Data.Headers in GetRemote · Issue #12521 · gohugoio/hugo · GitHub or one not related to resources :smiling_imp:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.