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