From 66cbbb968c58f9c35adf5dd9a59119dc0b7d7b9f Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Thu, 1 Aug 2024 19:49:19 +0200 Subject: [PATCH] Improve logging for non-200 response codes on getting policy file --- lib/ff_bot/policy.ex | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ff_bot/policy.ex b/lib/ff_bot/policy.ex index 2102e41..ceb1f6d 100644 --- a/lib/ff_bot/policy.ex +++ b/lib/ff_bot/policy.ex @@ -22,7 +22,7 @@ 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), @@ -30,9 +30,13 @@ defmodule FFBot.Policy do ) # 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