From 155566a2b0d2a7745f3e7dfb458cfc4737809cf6 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 28 Jul 2023 23:41:48 +0000 Subject: [PATCH] report extra information if a repo can't be found --- common/lib/dependabot/file_fetchers/base.rb | 2 +- updater/lib/dependabot/file_fetcher_command.rb | 4 ++-- updater/spec/dependabot/file_fetcher_command_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/lib/dependabot/file_fetchers/base.rb b/common/lib/dependabot/file_fetchers/base.rb index e5265803da3..ebf951562db 100644 --- a/common/lib/dependabot/file_fetchers/base.rb +++ b/common/lib/dependabot/file_fetchers/base.rb @@ -100,7 +100,7 @@ def clone_repo_contents raise Dependabot::OutOfDisk end - raise Dependabot::RepoNotFound, source + raise Dependabot::RepoNotFound.new(source, e.message) end def ecosystem_versions diff --git a/updater/lib/dependabot/file_fetcher_command.rb b/updater/lib/dependabot/file_fetcher_command.rb index a07e5e7f85b..950039a1e3c 100644 --- a/updater/lib/dependabot/file_fetcher_command.rb +++ b/updater/lib/dependabot/file_fetcher_command.rb @@ -36,7 +36,7 @@ def perform_job Dependabot.logger.error("Repository is rate limited, attempting to retry in " \ "#{remaining}s") else - Dependabot.logger.error("Error during file fetching; aborting") + Dependabot.logger.error("Error during file fetching; aborting: #{e.message}") end handle_file_fetcher_error(e) service.mark_job_as_processed(@base_commit_sha) @@ -144,7 +144,7 @@ def handle_file_fetcher_error(error) # This also happens when a configured personal access token is not authz'd to fetch files from the job repo. { "error-type": "job_repo_not_found", - "error-detail": {} + "error-detail": { message: error.message } } when Dependabot::DependencyFileNotParseable { diff --git a/updater/spec/dependabot/file_fetcher_command_spec.rb b/updater/spec/dependabot/file_fetcher_command_spec.rb index 00491c5b324..f8a875ac97b 100644 --- a/updater/spec/dependabot/file_fetcher_command_spec.rb +++ b/updater/spec/dependabot/file_fetcher_command_spec.rb @@ -115,7 +115,7 @@ expect(api_client) .to receive(:record_update_job_error) .with( - error_details: {}, + error_details: { message: "Dependabot::RepoNotFound" }, error_type: "job_repo_not_found" ) expect(api_client).to receive(:mark_job_as_processed)