Skip to content

Commit 83499df

Browse files
committed
Wrap AssertionError in mysql
1 parent fb1b8f5 commit 83499df

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

mysql-plugin/src/main/java/io/cdap/plugin/mysql/MysqlConstants.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@
1616

1717
package io.cdap.plugin.mysql;
1818

19+
import io.cdap.cdap.api.exception.ErrorCategory;
20+
import io.cdap.cdap.api.exception.ErrorType;
21+
import io.cdap.cdap.api.exception.ErrorUtils;
22+
1923
/**
2024
* MySQL Constants.
2125
*/
2226
public final class MysqlConstants {
2327
private MysqlConstants() {
24-
throw new AssertionError("Should not instantiate static utility class.");
28+
String errorMessage = "Should not instantiate static utility class.";
29+
throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
30+
errorMessage, errorMessage, ErrorType.SYSTEM, false, new AssertionError(errorMessage));
2531
}
2632

2733
public static final String PLUGIN_NAME = "Mysql";

mysql-plugin/src/main/java/io/cdap/plugin/mysql/MysqlUtil.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
package io.cdap.plugin.mysql;
1818

1919
import com.google.common.collect.ImmutableMap;
20+
import io.cdap.cdap.api.exception.ErrorCategory;
21+
import io.cdap.cdap.api.exception.ErrorType;
22+
import io.cdap.cdap.api.exception.ErrorUtils;
2023

2124
import java.sql.Types;
2225
import java.util.Map;
@@ -26,7 +29,9 @@
2629
*/
2730
public final class MysqlUtil {
2831
private MysqlUtil() {
29-
throw new AssertionError("Should not instantiate static utility class.");
32+
String errorMessage = "Should not instantiate static utility class.";
33+
throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
34+
errorMessage, errorMessage, ErrorType.SYSTEM, false, new AssertionError(errorMessage));
3035
}
3136

3237
/**

0 commit comments

Comments
 (0)