Skip to content

Commit

Permalink
Improve logging for non-200 response codes on getting policy file
Browse files Browse the repository at this point in the history
  • Loading branch information
jchristgit committed Aug 1, 2024
1 parent fcb343a commit 66cbbb9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/ff_bot/policy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ defmodule FFBot.Policy do
"""
def get_policy_file(token, owner, repo) do
# Get the file
file =
response =
GitHub.Request.request(
:get,
GitHub.Endpoint.policy_file(owner, repo),
auth: {:token, token}
)

# If we found the file, parse it, else return a missing file error.
case file do
{200, file} -> parse_file(file["content"])
_ -> {:error, :missing_config}
case response do
{200, json} ->
parse_file(json["content"])

{status, json} ->
Logger.error("Retrieved code #{status} with response #{inspect(json)} for policy file at #{owner}/#{repo}")
{:error, :missing_config}
end
end

Expand Down

0 comments on commit 66cbbb9

Please sign in to comment.