guibou / krank

Krank checks your code source comments for important markers
BSD 3-Clause "New" or "Revised" License
21 stars 3 forks source link

feat: show raw HTTP response in case of error #51

Closed gbataille closed 4 years ago

gbataille commented 4 years ago

Linked to #50

As discussed, first PR to just show the raw error to give the user some context

/Users/gbataille/Downloads/configuration-common.nix:1378:5: warning:
  Url could not be reached:
    Error:
      StatusCodeException (Response {responseStatus = Status {statusCode = 403, statusMessage = "Forbidden"}, responseVersion = HTTP/1.1, responseHeaders = [("Date","Sun, 09 Feb 2020 15:44:49 GMT"),("Content-Type","application/json; charset=utf-8"),("Transfer-Encoding","chunked"),("Server","GitHub.com"),("Status","403 Forbidden"),("X-RateLimit-Limit","60"),("X-RateLimit-Remaining","0"),("X-RateLimit-Reset","1581266229"),("X-GitHub-Media-Type","github.v3"),("Access-Control-Expose-Headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type"),("Access-Control-Allow-Origin","*"),("Strict-Transport-Security","max-age=31536000; includeSubdomains; preload"),("X-Frame-Options","deny"),("X-Content-Type-Options","nosniff"),("X-XSS-Protection","1; mode=block"),("Referrer-Policy","origin-when-cross-origin, strict-origin-when-cross-origin"),("Content-Security-Policy","default-src 'none'"),("Vary","Accept-Encoding, Accept"),("Content-Encoding","gzip"),("X-GitHub-Request-Id","1191:0145:B63168:D7F036:5E4028F0")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}) "{\"message\":\"API rate limit exceeded for 86.111.139.2. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"https://developer.github.com/v3/#rate-limiting\"}"
    Requested URL:
      Url Https ("15" :| ["issues","servant-ekg","haskell-servant","repos","api.github.com"])
  : https://github.com/haskell-servant/servant-ekg/issues/15