mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
---
|
||||
title: Err
|
||||
description: Applicable to resources returned by the resources.GetRemote function, returns an error message if the HTTP request fails, else nil.
|
||||
description: Applicable to resources returned by the resources.GetRemote function, returns an error message if the HTTP request fails, else nil.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- functions/resources/GetRemote
|
||||
- methods/resource/Data
|
||||
returnType: resource.resourceError
|
||||
signatures: [RESOURCE.Err]
|
||||
params:
|
||||
functions_and_methods:
|
||||
returnType: resource.resourceError
|
||||
signatures: [RESOURCE.Err]
|
||||
expiryDate: 2027-01-16 # deprecated 2025-01-16 in v0.141.0
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.141.0 %}}
|
||||
{{< deprecated-in 0.141.0 >}}
|
||||
Use the `try` statement instead. See [example].
|
||||
|
||||
[example]: /functions/go-template/try/#example
|
||||
{{% /deprecated-in %}}
|
||||
{{< /deprecated-in >}}
|
||||
|
||||
The `Err` method on a resource returned by the [`resources.GetRemote`] function returns an error message if the HTTP request fails, else nil. If you do not handle the error yourself, Hugo will fail the build.
|
||||
|
||||
@@ -58,6 +56,5 @@ To log an error as a warning instead of an error:
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
An HTTP response with a 404 status code is not an HTTP request error. To handle 404 status codes, code defensively using the nested `with-else-end` construct as shown above.
|
||||
{{% /note %}}
|
||||
> [!note]
|
||||
> An HTTP response with a 404 status code is not an HTTP request error. To handle 404 status codes, code defensively using the nested `with-else-end` construct as shown above.
|
||||
|
Reference in New Issue
Block a user