Skip to content

Error logs for unexpected status code should contain URLs #61

Closed
@dschanoeh

Description

@dschanoeh

It'd be useful if URLs were always included in the error that the ErrorSink receives.
For example the error returned here

return fmt.Errorf(`httprc.Resource.Sync: failed to execute HTTP request: %w`, err)

can contain the URL:

httprc.Resource.Sync: failed to execute HTTP request: Get "https://invalid": dial tcp: lookup invalid: no such host

whereas the error returned here

return fmt.Errorf(`httprc.Resource.Sync: %w (status code=%d)`, errUnexpectedStatusCode, res.StatusCode)

doesn't:

httprc.Resource.Sync: unexpected status code (status code=404)

I'm using this library via lestrrat-go/jwx and in setups with many JWKS URLs in the cache, it'd be helpful to immediately spot the one that has problems from the error logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions