Skip to content

Commit be22e67

Browse files
authored
Use FeatureNotSupportedException instead of RuntimeException where appropriate (#145)
HIBERNATE-45
1 parent a668377 commit be22e67

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/main/java/com/mongodb/hibernate/jdbc/DatabaseMetaDataAdapter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.mongodb.hibernate.jdbc;
1818

19+
import com.mongodb.hibernate.internal.FeatureNotSupportedException;
1920
import java.sql.Connection;
2021
import java.sql.DatabaseMetaData;
2122
import java.sql.ResultSet;
@@ -102,12 +103,12 @@ default String getDriverVersion() throws SQLException {
102103

103104
@Override
104105
default int getDriverMajorVersion() {
105-
throw new RuntimeException("getDriverMajorVersion not implemented");
106+
throw new FeatureNotSupportedException("getDriverMajorVersion not implemented");
106107
}
107108

108109
@Override
109110
default int getDriverMinorVersion() {
110-
throw new RuntimeException("getDriverMinorVersion not implemented");
111+
throw new FeatureNotSupportedException("getDriverMinorVersion not implemented");
111112
}
112113

113114
@Override

src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private static boolean isExcludeProjectSpecification(Map.Entry<String, BsonValue
150150
var exclude = (value.isBoolean() && !value.asBoolean().getValue())
151151
|| (value.isNumber() && value.asNumber().intValue() == 0);
152152
if (exclude && !key.equals(ID_FIELD_NAME)) {
153-
throw new RuntimeException(format(
153+
throw new FeatureNotSupportedException(format(
154154
"Exclusions are not allowed in `$project` specifications, except for the [%s] field: [%s, %s]",
155155
ID_FIELD_NAME, key, value));
156156
}

0 commit comments

Comments
 (0)