File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
src/main/java/org/utplsql/cli Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 44import com .beust .jcommander .Parameter ;
55import com .beust .jcommander .ParameterException ;
66import org .utplsql .api .exception .DatabaseNotCompatibleException ;
7+ import org .utplsql .api .exception .UtPLSQLNotInstalledException ;
8+ import org .utplsql .cli .exception .DatabaseConnectionFailed ;
79
810public class Cli {
911
@@ -35,7 +37,7 @@ public static void main(String[] args) {
3537 } else {
3638 jc .usage ();
3739 }
38- } catch ( DatabaseNotCompatibleException e ) {
40+ } catch ( DatabaseNotCompatibleException | UtPLSQLNotInstalledException | DatabaseConnectionFailed e ) {
3941 System .out .println (e .getMessage ());
4042 } catch (Exception e ) {
4143 e .printStackTrace ();
Original file line number Diff line number Diff line change 88import org .utplsql .api .exception .SomeTestsFailedException ;
99import org .utplsql .api .reporter .Reporter ;
1010import org .utplsql .api .reporter .ReporterFactory ;
11+ import org .utplsql .cli .exception .DatabaseConnectionFailed ;
1112
1213import java .io .File ;
1314import java .io .FileNotFoundException ;
@@ -120,8 +121,12 @@ public int run() throws Exception {
120121 reporterList = initReporters (conn , reporterOptionsList );
121122
122123 } catch (SQLException e ) {
123- System .out .println (e .getMessage ());
124- return Cli .DEFAULT_ERROR_CODE ;
124+ if ( e .getErrorCode () == 1017 || e .getErrorCode () == 12514 ) {
125+ throw new DatabaseConnectionFailed (e );
126+ }
127+ else {
128+ throw e ;
129+ }
125130 }
126131
127132 ExecutorService executorService = Executors .newFixedThreadPool (1 + reporterList .size ());
Original file line number Diff line number Diff line change 1+ package org .utplsql .cli .exception ;
2+
3+ import java .sql .SQLException ;
4+
5+ public class DatabaseConnectionFailed extends SQLException {
6+
7+ public DatabaseConnectionFailed (SQLException cause ) {
8+ super ( "Could not establish connection to database. Reason: " + cause .getMessage (), cause );
9+ }
10+ }
You can’t perform that action at this time.
0 commit comments