Skip to content

Change validation exceptions to unchecked exceptions #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ allprojects {
targetCompatibility = JavaVersion.VERSION_1_8
}

version = '4.1.1'
version = '4.1.2'
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import software.amazon.cloudwatchlogs.emf.Constants;

public class DimensionSetExceededException extends Exception {
public class DimensionSetExceededException extends RuntimeException {

public DimensionSetExceededException() {
super(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package software.amazon.cloudwatchlogs.emf.exception;

public class InvalidDimensionException extends Exception {
public class InvalidDimensionException extends IllegalArgumentException {
public InvalidDimensionException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package software.amazon.cloudwatchlogs.emf.exception;

public class InvalidMetricException extends Exception {
public class InvalidMetricException extends IllegalArgumentException {
public InvalidMetricException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package software.amazon.cloudwatchlogs.emf.exception;

public class InvalidNamespaceException extends Exception {
public class InvalidNamespaceException extends IllegalArgumentException {
public InvalidNamespaceException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package software.amazon.cloudwatchlogs.emf.exception;

public class InvalidTimestampException extends Exception {
public class InvalidTimestampException extends IllegalArgumentException {
public InvalidTimestampException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ public class DimensionSet {
* @param v1 Value of the single dimension
* @return a DimensionSet from the parameters
* @throws InvalidDimensionException if the dimension name or value is invalid
* @throws DimensionSetExceededException if the number of dimensions exceeds the limit
*/
public static DimensionSet of(String d1, String v1)
throws InvalidDimensionException, DimensionSetExceededException {
public static DimensionSet of(String d1, String v1) throws InvalidDimensionException {
return fromEntries(entryOf(d1, v1));
}

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

Expand All @@ -74,10 +71,9 @@ public static DimensionSet of(String d1, String v1, String d2, String v2)
* @param v3 Value of the third dimension
* @return a DimensionSet from the parameters
* @throws InvalidDimensionException if the dimension name or value is invalid
* @throws DimensionSetExceededException if the number of dimensions exceeds the limit
*/
public static DimensionSet of(String d1, String v1, String d2, String v2, String d3, String v3)
throws InvalidDimensionException, DimensionSetExceededException {
throws InvalidDimensionException {
return fromEntries(entryOf(d1, v1), entryOf(d2, v2), entryOf(d3, v3));
}

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

return fromEntries(entryOf(d1, v1), entryOf(d2, v2), entryOf(d3, v3), entryOf(d4, v4));
}
Expand All @@ -118,7 +113,6 @@ public static DimensionSet of(
* @param v5 Value of the fifth dimension
* @return a DimensionSet from the parameters
* @throws InvalidDimensionException if the dimension name or value is invalid
* @throws DimensionSetExceededException if the number of dimensions exceeds the limit
*/
public static DimensionSet of(
String d1,
Expand All @@ -131,7 +125,7 @@ public static DimensionSet of(
String v4,
String d5,
String v5)
throws InvalidDimensionException, DimensionSetExceededException {
throws InvalidDimensionException {

return fromEntries(
entryOf(d1, v1),
Expand Down