We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ea98c34 + 05cf01b commit ffd12b7Copy full SHA for ffd12b7
files/pe_metrics.rb
@@ -79,7 +79,16 @@ def post_endpoint(url, body)
79
end
80
81
def retrieve_additional_metrics(url, _metrics_type, metrics)
82
- metrics_output = post_endpoint(url, metrics.to_json)
+ begin
83
+ json_data = metrics.to_json
84
+ rescue StandardError => e
85
+ STDERR.puts 'Failed to convert metrics to JSON.'
86
+ STDERR.puts "Error: #{e.message}"
87
+ STDERR.puts e.backtrace
88
+ return []
89
+ end
90
+
91
+ metrics_output = post_endpoint(url, json_data)
92
return [] if metrics_output.empty?
93
94
# For a status other than 200 or 404, add the HTTP code to the error array
0 commit comments