-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
264 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...queries/src/main/java/de/chojo/sadu/queries/exception/IllegalQueryParameterException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* Copyright (C) RainbowDashLabs and Contributor | ||
*/ | ||
|
||
package de.chojo.sadu.queries.exception; | ||
|
||
public class IllegalQueryParameterException extends RuntimeQueryException{ | ||
public IllegalQueryParameterException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
sadu-queries/src/main/java/de/chojo/sadu/queries/exception/QueryException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* Copyright (C) RainbowDashLabs and Contributor | ||
*/ | ||
|
||
package de.chojo.sadu.queries.exception; | ||
|
||
import de.chojo.sadu.queries.query.ParsedQueryImpl; | ||
|
||
import java.io.Serial; | ||
import java.sql.SQLException; | ||
|
||
public class QueryException extends SQLException { | ||
|
||
@Serial | ||
private static final long serialVersionUID = 1; | ||
|
||
/** | ||
* Cause of the exception | ||
*/ | ||
private final SQLException cause; | ||
|
||
/** | ||
* Creates a new exception. | ||
*/ | ||
public QueryException(ParsedQueryImpl query, SQLException throwable) { | ||
super("An error occurred: %s\nWhile executing query:\n%s".formatted(throwable.getMessage(), query.sql().sql().stripIndent()), throwable); | ||
cause = throwable; | ||
} | ||
|
||
/** | ||
* SQL state of the exception | ||
* | ||
* @return sql state | ||
*/ | ||
public String getSQLState() { | ||
return cause.getSQLState(); | ||
} | ||
|
||
/** | ||
* Error code of the exception | ||
* | ||
* @return error code | ||
*/ | ||
public int getErrorCode() { | ||
return cause.getErrorCode(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
sadu-queries/src/main/java/de/chojo/sadu/queries/exception/RuntimeQueryException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* Copyright (C) RainbowDashLabs and Contributor | ||
*/ | ||
|
||
package de.chojo.sadu.queries.exception; | ||
|
||
public class RuntimeQueryException extends RuntimeException{ | ||
public RuntimeQueryException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.