From 2b8573e5bbb93a7dc128208560276b42c55f622b Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 20 Aug 2018 11:23:22 -0400 Subject: [PATCH] error handling --- runner.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/runner.cs b/runner.cs index b6937b3..d4836a1 100644 --- a/runner.cs +++ b/runner.cs @@ -24,7 +24,7 @@ namespace test string msg = "Help:"; msg = msg + Environment.NewLine; - msg = msg + "version 0.11"; + msg = msg + "version 0.12"; msg = msg + Environment.NewLine; msg = msg + "-scs source connection string"; msg = msg + Environment.NewLine; @@ -106,7 +106,19 @@ namespace test Console.Write("etl start:" + DateTime.Now.ToString()); NpgsqlTransaction pgt = pgc.BeginTransaction(); ibmcmd.CommandTimeout = 600; - var ibmdr = ibmcmd.ExecuteReader(); + System.Data.Odbc.OdbcDataReader ibmdr; + try { + ibmdr = ibmcmd.ExecuteReader(); + } + catch (Exception e) { + Console.Write(Environment.NewLine); + Console.Write("error on source sql:"); + Console.Write(Environment.NewLine); + Console.Write(e.Message); + ibmc.Close(); + pgc.Close(); + return; + } //setup getv object array dimensioned to number of columns for scenario var getv = new object[ibmdr.FieldCount]; @@ -184,7 +196,7 @@ namespace test catch (Exception e) { Console.Write(Environment.NewLine); Console.Write(e.Message); - ibmc.Close(); + //ibmc.Close(); pgt.Rollback(); pgc.Close();