Repositories.ListHooks(ctx, owner, repository, opts) returns hooks, response, and error. If response failed with codes such as 404 or 403, this is not reflected in the error code. Using errors.Code(err) when response returns an error HTTP status code will simply return codes.Unknown, when it should really be codes.PermissionDenied or codes.NotFound.
Propose a change where we map HTTP Response status codes (if error) into the error object's error code.
Repositories.ListHooks(ctx, owner, repository, opts)returns hooks, response, and error. If response failed with codes such as404or403, this is not reflected in the error code. Usingerrors.Code(err)whenresponsereturns an error HTTP status code will simply returncodes.Unknown, when it should really becodes.PermissionDeniedorcodes.NotFound.Propose a change where we map HTTP Response status codes (if error) into the error object's error code.