Why the error info could not interrupt hugo command and exit?

In my theme there were added a logic which use to judge the minimum version for this theme running request. So if meet lower version then will output error message, but the hugo command not stopped and go on building.

I found the documents said Any ERROR will also cause the build to fail (the hugo command will exit -1). but in here why not?

Were you meet the same problement?

# The code is here
{{ $version := int (index (split hugo.Version ".") 1) }}
{{ if lt $version 89 }}
  {{ warnf "当前 Hugo 版本小于 0.89.0,请到官方地址下载 Hugo 最新版本:https://github.com/gohugoio/hugo/releases" }}  
  {{ errorf "Current Hugo version is less then 0.89.0, Please download Hugo latest version on offical site: https://github.com/gohugoio/hugo/releases" }}  
{{ end }}

{{ if not hugo.IsExtended }}
  {{ warnf "Hugo NexT 主题使用了 SCSS 框架,请到官方地址下载 Hugo Extended 版本:https://github.com/gohugoio/hugo/releases" }}  
  {{ errorf "Because that use SCSS framework in Hugo NexT, Please download Hugo extended version on offical site: https://github.com/gohugoio/hugo/releases" }}  
{{ end }}

Actually result was:

And that found sometime will duplicate output the warn or error info message, I don’t know why?

I’m pretty sure that it does. What exit code do you see?

There could not saw throws any error code, because it’s my customer errorf output when some environment not ready.(Code: layouts/partials/init.html#L3-L12) You could clone the theme repository from hugo-next/hugo-theme-next and then run under Hugo which version is letter than 0.89.0 and will see the error.

Thanks @bep .

This is the OS exit code, it’s not visible in the log: Exit status - Wikipedia

And as I said, I’m pretty sure it’s there.

Sorry, there can’t visited this WIKI link, and I don’t known how to I found the exit code. My PC was used the Win10 OS environment.

I want it work as below flow: