mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-11 12:19:01 +00:00
Clarify context in example of using the try statement
This commit is contained in:
1 parent
56d9c9b711
commit
7c03eb0cc3
1 file changed
+3
@@ -104,6 +104,9 @@ Instead of failing the build, we can catch the error and emit a warning:
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
In the above, note that the [context](/getting-started/glossary/#context) within the last conditional block is the `TryValue` object returned by the `try` statement. At this point neither the `Err` nor `Value` methods returned anything, so the current context is not useful. Use the `$` to access the [template context] if needed.
|
||||
|
||||
[template context]: /templates/introduction/#template-context
|
||||
|
||||
{{% note %}}
|
||||
Hugo does not classify an HTTP response with status code 404 as an error. In this case `resources.GetRemote` returns nil.
|
||||
|
||||
Reference in new issue
Block a user