Commit a4e6123e authored by Marius Bobin's avatar Marius Bobin

Use Gitlab::HTTP.try_get to handle errors

parent 58059f97
...@@ -86,12 +86,11 @@ class TeamcityService < CiService ...@@ -86,12 +86,11 @@ class TeamcityService < CiService
def calculate_reactive_cache(sha, ref) def calculate_reactive_cache(sha, ref)
response = get_path("httpAuth/app/rest/builds/branch:unspecified:any,revision:#{sha}") response = get_path("httpAuth/app/rest/builds/branch:unspecified:any,revision:#{sha}")
{ build_page: read_build_page(response), commit_status: read_commit_status(response) } if response
{ build_page: read_build_page(response), commit_status: read_commit_status(response) }
rescue Errno::ECONNREFUSED => e else
Gitlab::ErrorTracking.log_exception(e, project_id: project_id) { build_page: teamcity_url, commit_status: :error }
end
{ build_page: teamcity_url, commit_status: :error }
end end
def execute(data) def execute(data)
...@@ -154,7 +153,7 @@ class TeamcityService < CiService ...@@ -154,7 +153,7 @@ class TeamcityService < CiService
end end
def get_path(path) def get_path(path)
Gitlab::HTTP.get(build_url(path), verify: false, basic_auth: basic_auth) Gitlab::HTTP.try_get(build_url(path), verify: false, basic_auth: basic_auth, extra_log_info: { project_id: project_id })
end end
def post_to_build_queue(data, branch) def post_to_build_queue(data, branch)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment