Skip to content

Commit 39f61f9

Browse files
author
Mark Kuhn
authored
Change validation exceptions to unchecked exceptions (#141)
1 parent ecbccd7 commit 39f61f9

7 files changed

+11
-17
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ allprojects {
2929
targetCompatibility = JavaVersion.VERSION_1_8
3030
}
3131

32-
version = '4.1.1'
32+
version = '4.1.2'
3333
}
3434

3535
java {

src/main/java/software/amazon/cloudwatchlogs/emf/exception/DimensionSetExceededException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import software.amazon.cloudwatchlogs.emf.Constants;
2020

21-
public class DimensionSetExceededException extends Exception {
21+
public class DimensionSetExceededException extends RuntimeException {
2222

2323
public DimensionSetExceededException() {
2424
super(

src/main/java/software/amazon/cloudwatchlogs/emf/exception/InvalidDimensionException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package software.amazon.cloudwatchlogs.emf.exception;
1818

19-
public class InvalidDimensionException extends Exception {
19+
public class InvalidDimensionException extends IllegalArgumentException {
2020
public InvalidDimensionException(String message) {
2121
super(message);
2222
}

src/main/java/software/amazon/cloudwatchlogs/emf/exception/InvalidMetricException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package software.amazon.cloudwatchlogs.emf.exception;
1818

19-
public class InvalidMetricException extends Exception {
19+
public class InvalidMetricException extends IllegalArgumentException {
2020
public InvalidMetricException(String message) {
2121
super(message);
2222
}

src/main/java/software/amazon/cloudwatchlogs/emf/exception/InvalidNamespaceException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package software.amazon.cloudwatchlogs.emf.exception;
1818

19-
public class InvalidNamespaceException extends Exception {
19+
public class InvalidNamespaceException extends IllegalArgumentException {
2020
public InvalidNamespaceException(String message) {
2121
super(message);
2222
}

src/main/java/software/amazon/cloudwatchlogs/emf/exception/InvalidTimestampException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package software.amazon.cloudwatchlogs.emf.exception;
1818

19-
public class InvalidTimestampException extends Exception {
19+
public class InvalidTimestampException extends IllegalArgumentException {
2020
public InvalidTimestampException(String message) {
2121
super(message);
2222
}

src/main/java/software/amazon/cloudwatchlogs/emf/model/DimensionSet.java

+5-11
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ public class DimensionSet {
4040
* @param v1 Value of the single dimension
4141
* @return a DimensionSet from the parameters
4242
* @throws InvalidDimensionException if the dimension name or value is invalid
43-
* @throws DimensionSetExceededException if the number of dimensions exceeds the limit
4443
*/
45-
public static DimensionSet of(String d1, String v1)
46-
throws InvalidDimensionException, DimensionSetExceededException {
44+
public static DimensionSet of(String d1, String v1) throws InvalidDimensionException {
4745
return fromEntries(entryOf(d1, v1));
4846
}
4947

@@ -56,10 +54,9 @@ public static DimensionSet of(String d1, String v1)
5654
* @param v2 Value of the second dimension
5755
* @return a DimensionSet from the parameters
5856
* @throws InvalidDimensionException if the dimension name or value is invalid
59-
* @throws DimensionSetExceededException if the number of dimensions exceeds the limit
6057
*/
6158
public static DimensionSet of(String d1, String v1, String d2, String v2)
62-
throws InvalidDimensionException, DimensionSetExceededException {
59+
throws InvalidDimensionException {
6360
return fromEntries(entryOf(d1, v1), entryOf(d2, v2));
6461
}
6562

@@ -74,10 +71,9 @@ public static DimensionSet of(String d1, String v1, String d2, String v2)
7471
* @param v3 Value of the third dimension
7572
* @return a DimensionSet from the parameters
7673
* @throws InvalidDimensionException if the dimension name or value is invalid
77-
* @throws DimensionSetExceededException if the number of dimensions exceeds the limit
7874
*/
7975
public static DimensionSet of(String d1, String v1, String d2, String v2, String d3, String v3)
80-
throws InvalidDimensionException, DimensionSetExceededException {
76+
throws InvalidDimensionException {
8177
return fromEntries(entryOf(d1, v1), entryOf(d2, v2), entryOf(d3, v3));
8278
}
8379

@@ -94,11 +90,10 @@ public static DimensionSet of(String d1, String v1, String d2, String v2, String
9490
* @param v4 Value of the fourth dimension
9591
* @return a DimensionSet from the parameters
9692
* @throws InvalidDimensionException if the dimension name or value is invalid
97-
* @throws DimensionSetExceededException if the number of dimensions exceeds the limit
9893
*/
9994
public static DimensionSet of(
10095
String d1, String v1, String d2, String v2, String d3, String v3, String d4, String v4)
101-
throws InvalidDimensionException, DimensionSetExceededException {
96+
throws InvalidDimensionException {
10297

10398
return fromEntries(entryOf(d1, v1), entryOf(d2, v2), entryOf(d3, v3), entryOf(d4, v4));
10499
}
@@ -118,7 +113,6 @@ public static DimensionSet of(
118113
* @param v5 Value of the fifth dimension
119114
* @return a DimensionSet from the parameters
120115
* @throws InvalidDimensionException if the dimension name or value is invalid
121-
* @throws DimensionSetExceededException if the number of dimensions exceeds the limit
122116
*/
123117
public static DimensionSet of(
124118
String d1,
@@ -131,7 +125,7 @@ public static DimensionSet of(
131125
String v4,
132126
String d5,
133127
String v5)
134-
throws InvalidDimensionException, DimensionSetExceededException {
128+
throws InvalidDimensionException {
135129

136130
return fromEntries(
137131
entryOf(d1, v1),

0 commit comments

Comments
 (0)