Compare commits

...

2 commits

Author SHA1 Message Date
0xB10C 41f4d84657
Merge cf5d0c1f91 into 38e05bd3c7 2024-03-27 11:22:35 +03:00
0xb10c cf5d0c1f91
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.
2024-03-18 11:07:51 +01:00

View file

@ -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)
}
}