From cf5d0c1f913a1563e4163f185949e7eb7519d1bd Mon Sep 17 00:00:00 2001 From: 0xb10c Date: Mon, 18 Mar 2024 11:07:30 +0100 Subject: [PATCH] add URI to resource load error Previouly, only "ERROR failed to fetch remote resource: Forbidden" would be shown when a resource failed to load. In my case, a tweet's author I was embedding using the twitter shortcode switched his profile to private which resulted in my blog failing to build. To figure out where the originates, I added the log to the error message. --- resources/resource_factories/create/remote.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/resource_factories/create/remote.go b/resources/resource_factories/create/remote.go index c2d17e7a5..d487bf53c 100644 --- a/resources/resource_factories/create/remote.go +++ b/resources/resource_factories/create/remote.go @@ -138,7 +138,7 @@ func (c *Client) FromRemote(uri string, optionsm map[string]any) (resource.Resou if res.StatusCode != http.StatusNotFound { if res.StatusCode < 200 || res.StatusCode > 299 { - return nil, temporaryHTTPStatusCodes[res.StatusCode], toHTTPError(fmt.Errorf("failed to fetch remote resource: %s", http.StatusText(res.StatusCode)), res, !isHeadMethod) + return nil, temporaryHTTPStatusCodes[res.StatusCode], toHTTPError(fmt.Errorf("failed to fetch remote resource from '%s': %s", uri, http.StatusText(res.StatusCode)), res, !isHeadMethod) } }