|
28 | 28 | import java.util.logging.Logger; |
29 | 29 |
|
30 | 30 | import org.utplsql.sqldev.dal.UtplsqlDao; |
| 31 | +import org.utplsql.sqldev.exception.GenericDatabaseAccessException; |
| 32 | +import org.utplsql.sqldev.exception.GenericRuntimeException; |
31 | 33 | import org.utplsql.sqldev.ui.coverage.CodeCoverageReporterDialog; |
32 | 34 |
|
33 | 35 | import oracle.dbtools.raptor.utils.Connections; |
@@ -63,18 +65,20 @@ private void setConnection(final String connectionName) { |
63 | 65 | if (connectionName == null) { |
64 | 66 | final String msg = "Cannot initialize a CodeCoverageReporter without a ConnectionName"; |
65 | 67 | logger.severe(() -> msg); |
66 | | - throw new RuntimeException(msg); |
| 68 | + throw new NullPointerException(); |
67 | 69 | } else { |
68 | 70 | try { |
69 | 71 | // must be closed manually |
70 | 72 | conn = Connections.getInstance() |
71 | 73 | .cloneConnection(Connections.getInstance().getConnection(connectionName)); |
72 | 74 | } catch (ConnectionException e) { |
73 | | - logger.severe(() -> "ConnectionException while setting connection: " + e.getMessage()); |
74 | | - throw new RuntimeException(e); |
| 75 | + final String msg = "ConnectionException while setting connection: " + e.getMessage(); |
| 76 | + logger.severe(() -> msg); |
| 77 | + throw new GenericDatabaseAccessException(msg, e); |
75 | 78 | } catch (DBException e) { |
76 | | - logger.severe(() -> "DBException while setting connection: " + e.getMessage()); |
77 | | - throw new RuntimeException(e); |
| 79 | + final String msg = "DBException while setting connection: " + e.getMessage(); |
| 80 | + logger.severe(() -> msg); |
| 81 | + throw new GenericDatabaseAccessException(msg, e); |
78 | 82 | } |
79 | 83 | } |
80 | 84 | } |
@@ -111,8 +115,9 @@ private void run() { |
111 | 115 | () -> "Could not launch " + file + "in browser. No default browser defined on this system."); |
112 | 116 | } |
113 | 117 | } catch (Exception e) { |
114 | | - logger.severe(() -> "Error while running code coverage: " + e.getMessage()); |
115 | | - throw new RuntimeException(e); |
| 118 | + final String msg = "Error while running code coverage: " + e.getMessage(); |
| 119 | + logger.severe(() -> msg); |
| 120 | + throw new GenericRuntimeException(msg, e); |
116 | 121 | } finally { |
117 | 122 | try { |
118 | 123 | conn.close(); |
|
0 commit comments