Skip to content

Commit

Permalink
Add exception handling for JSON::ParserError
Browse files Browse the repository at this point in the history
  • Loading branch information
ton31337 committed Nov 16, 2017
1 parent f94e38a commit 54e4d48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/organization_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ def _do_request(grafana_options, payload=nil)
success: grafana_options[:success_msg],
unknown_code: grafana_options[:unknown_code_msg]
)
JSON.parse(response.body)
begin
JSON.parse(response.body)
rescue JSON::ParserError
nil
end
rescue BackendError
nil
end
Expand Down

0 comments on commit 54e4d48

Please sign in to comment.