Skip to content

Commit 8f481f3

Browse files
committed
Exception class changed
1 parent 4ffbbfe commit 8f481f3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

instrumentation/jmx-metrics/library/src/main/java/io/opentelemetry/instrumentation/jmx/engine/unit/UnitConverterFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static UnitConverter getConverter(@Nullable String sourceUnit, String tar
3636
String converterKey = getConverterKey(sourceUnit, targetUnit);
3737
UnitConverter converter = conversionMappings.get(converterKey);
3838
if (converter == null) {
39-
throw new IllegalStateException(
39+
throw new IllegalArgumentException(
4040
"No [" + sourceUnit + "] to [" + targetUnit + "] unit converter");
4141
}
4242

instrumentation/jmx-metrics/library/src/test/java/io/opentelemetry/instrumentation/jmx/engine/unit/UnitConverterFactoryTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ void shouldSupportCustomConverter() {
7171
"non-existing, s",
7272
})
7373
void shouldHandleNonExistingConverter(String sourceUnit, String targetUnit) {
74-
IllegalStateException exception =
74+
IllegalArgumentException exception =
7575
assertThrows(
76-
IllegalStateException.class,
76+
IllegalArgumentException.class,
7777
() -> UnitConverterFactory.getConverter(sourceUnit, targetUnit));
7878
assertEquals(
7979
"No [" + sourceUnit + "] to [" + targetUnit + "] unit converter", exception.getMessage());

0 commit comments

Comments
 (0)