Skip to content

Commit 6e526f6

Browse files
committed
Create exception hierarchy
1 parent 71cb955 commit 6e526f6

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

src/main/java/org/mybatis/dynamic/sql/exception/DuplicateTableAliasException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 the original author or authors.
2+
* Copyright 2016-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
3030
* @since 1.3.1
3131
* @author Jeff Butler
3232
*/
33-
public class DuplicateTableAliasException extends RuntimeException {
33+
public class DuplicateTableAliasException extends DynamicSqlException {
3434

3535
public DuplicateTableAliasException(SqlTable table, String newAlias, String existingAlias) {
3636
super(generateMessage(Objects.requireNonNull(table),
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2016-2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.mybatis.dynamic.sql.exception;
17+
18+
public class DynamicSqlException extends RuntimeException {
19+
public DynamicSqlException(String message) {
20+
super(message);
21+
}
22+
}

src/main/java/org/mybatis/dynamic/sql/exception/InvalidSqlException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.mybatis.dynamic.sql.exception;
1717

18-
public class InvalidSqlException extends RuntimeException {
18+
public class InvalidSqlException extends DynamicSqlException {
1919
public InvalidSqlException(String message) {
2020
super(message);
2121
}

src/main/java/org/mybatis/dynamic/sql/exception/NonRenderingWhereClauseException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @since 1.4.1
3737
* @author Jeff Butler
3838
*/
39-
public class NonRenderingWhereClauseException extends RuntimeException {
39+
public class NonRenderingWhereClauseException extends DynamicSqlException {
4040
public NonRenderingWhereClauseException() {
4141
super("A where clause was specified, but failed to render."); //$NON-NLS-1$
4242
}

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/KInvalidSQLException.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616
package org.mybatis.dynamic.sql.util.kotlin
1717

18+
import org.mybatis.dynamic.sql.exception.DynamicSqlException
19+
1820
/**
1921
* This exception is thrown if the library detects misuse of the Kotlin DSL that would result in invalid SQL
2022
*/
21-
class KInvalidSQLException(message: String) : RuntimeException(message)
23+
class KInvalidSQLException(message: String) : DynamicSqlException(message)

0 commit comments

Comments
 (0)