Mercurial > stress-tester
changeset 1166:6b12314c35e5
JsonMetricsCollectionEncoder - exception on writeValue
author | Devel 2 |
---|---|
date | Tue, 16 Jun 2020 10:19:22 +0200 |
parents | f04a0325dc2c |
children | b1c2cc159e9c |
files | stress-tester/src/main/java/com/passus/st/metric/JsonMetricsCollectionEncoder.java |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/metric/JsonMetricsCollectionEncoder.java Tue Jun 16 10:18:57 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/metric/JsonMetricsCollectionEncoder.java Tue Jun 16 10:19:22 2020 +0200 @@ -69,9 +69,13 @@ jsonWriter.beginObject(); Set<String> names = metric.getAttributesName(); for (String name : names) { - jsonWriter.name(name); - Object value = metric.getAttributeValue(name); - writeValue(jsonWriter, value); + try { + jsonWriter.name(name); + Object value = metric.getAttributeValue(name); + writeValue(jsonWriter, value); + } catch (Exception e) { + throw new EncoderException("Unable to write attribute '" + name + "' in metric '" + metric.getName() + "'. " + e.getMessage(), e); + } } jsonWriter.endObject();