summaryrefslogtreecommitdiff
path: root/lib/gitlab/prometheus_client.rb
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2018-02-07 02:25:54 +0100
committerPawel Chojnacki <pawel@chojnacki.ws>2018-02-07 02:25:54 +0100
commit0e90284c11815f84c804e7e922e709b31ca6d029 (patch)
tree73c04b5accf3f317b36a9c1ca2f00b5454547d5a /lib/gitlab/prometheus_client.rb
parent5209689d956c727f784481c86fe61355385371f5 (diff)
downloadgitlab-ce-0e90284c11815f84c804e7e922e709b31ca6d029.tar.gz
Catch json parsing error as PrometheusErrorpawel/connect_to_prometheus_through_proxy-30480
Diffstat (limited to 'lib/gitlab/prometheus_client.rb')
-rw-r--r--lib/gitlab/prometheus_client.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/prometheus_client.rb b/lib/gitlab/prometheus_client.rb
index 8264501b1ae..10527972663 100644
--- a/lib/gitlab/prometheus_client.rb
+++ b/lib/gitlab/prometheus_client.rb
@@ -42,6 +42,8 @@ module Gitlab
def json_api_get(type, args = {})
path = ['api', 'v1', type].join('/')
get(path, args)
+ rescue JSON::ParserError
+ raise PrometheusError, 'Parsing response failed'
rescue Errno::ECONNREFUSED
raise PrometheusError, 'Connection refused'
end