diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-07-06 17:53:17 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-07-06 17:53:17 +0200 |
commit | 0efd374805ac49a0e6513c707520fc2f6f238afc (patch) | |
tree | a8c6a8862574bc41b7f60eeda8679c4cd70a79a2 /docs/content/en/functions | |
parent | 2b8d907ab731627f4e2a30442cd729064516c8bb (diff) | |
parent | 98293eaa1570b5aff4452021c8b6d6c8560b3f06 (diff) |
Merge commit '98293eaa1570b5aff4452021c8b6d6c8560b3f06'
Diffstat (limited to 'docs/content/en/functions')
-rw-r--r-- | docs/content/en/functions/errorf.md | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/content/en/functions/errorf.md b/docs/content/en/functions/errorf.md index 9105ff840..73c13da09 100644 --- a/docs/content/en/functions/errorf.md +++ b/docs/content/en/functions/errorf.md @@ -1,7 +1,7 @@ --- title: errorf linktitle: errorf -description: Evaluates a format string and logs it to ERROR. +description: Log ERROR and fail the build from the templates. date: 2017-09-30 publishdate: 2017-09-30 lastmod: 2017-09-30 @@ -18,9 +18,12 @@ deprecated: false aliases: [] --- -`errorf` will evaluate a format string, then output the result to the ERROR log. -This will also cause the build to fail. +`errorf` will evaluate a format string, then output the result to the ERROR log (and only once per error message to avoid flooding the log). + +This will also cause the build to fail (the `hugo` command will `exit -1`). ``` -{{ errorf "Something went horribly wrong! %s" err }} +{{ errorf "Failed to handle page %q" .Path }} ``` + +Note that `errorf` supports all the formatting verbs of the [fmt](https://golang.org/pkg/fmt/) package. |