This commit is contained in:
@@ -2,8 +2,8 @@ package hhn.temp.project.expections;
|
||||
|
||||
public class SQLNoConectionException extends RuntimeException {
|
||||
|
||||
public SQLNoConectionException(String message) {
|
||||
super(message);
|
||||
public SQLNoConectionException(String message, Exception e) {
|
||||
super(message + " ("+ e.getMessage()+")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ public class MySql {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
connection = DriverManager.getConnection(url, user, password);
|
||||
} catch (SQLException e) {
|
||||
throw new SQLNoConectionException("Cant connect to the database");
|
||||
throw new SQLNoConectionException("Cant connect to the database", e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new SQLNoConectionException("Cant connect to the database: Driver class not found!");
|
||||
throw new SQLNoConectionException("Cant connect to the database: Driver class not found!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user