From 6fed9479e22bf56361d439d454a8725b6e079791 Mon Sep 17 00:00:00 2001 From: yuki0920 Date: Sun, 6 Oct 2024 10:50:30 +0900 Subject: [PATCH] Fix log for documents --- ruby/app/models/document.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ruby/app/models/document.rb b/ruby/app/models/document.rb index 83a4c3c..2aeb00c 100644 --- a/ruby/app/models/document.rb +++ b/ruby/app/models/document.rb @@ -54,10 +54,12 @@ def save_summary(date) params = { date: date, type: 2, 'Subscription-Key': EDINET_API_KEY } response = Faraday.get(DOC_LIST_URL, params) - Rails.logger.info("Response status: #{response.status}") - Rails.logger.info("Response body: #{response.body}") + unless response.status == 200 + Rails.logger.error("status: #{response.status}, body: #{response.body}") + Rails.logger.info("EDINET_API_KEY: #{EDINET_API_KEY}") - raise "#{date}の書類一覧取得に失敗しました" if response.status != 200 + raise "#{date}の書類一覧取得に失敗しました" + end body = JSON.parse(response.body, symbolize_names: true) @@ -108,6 +110,8 @@ def download unless response.status == 200 Rails.logger.error("status: #{response.status}, body: #{response.body}") + Rails.logger.info("EDINET_API_KEY: #{EDINET_API_KEY}") + raise "#{document_id}の書類取得に失敗しました" end