Added Error Handling and Reporting
This commit is contained in:
@@ -43,7 +43,7 @@ namespace DataLoader
|
||||
// Find the docstyle based on the section type (step[1]) & the 'type' from the dbf
|
||||
// record sectype[0])
|
||||
string dstyleindx = ((stpseq == null || stpseq == "") ? " " : stpseq.Substring(1, 1)) + ((SecType==null||SecType == "") ? " " : SecType.Substring(0, 1));
|
||||
int docstyleindx = GetDocStyleIndx(dstyleindx, format, procitem, docver);
|
||||
int docstyleindx = GetDocStyleIndx(dstyleindx, format, procitem, docver,Number,Title);
|
||||
|
||||
// tack on the column mode - add to config xml for node.
|
||||
if (stpseq != null && stpseq.Substring(1, 1) == "0" && stpseq.Substring(5, 1) != " ")
|
||||
@@ -122,6 +122,7 @@ namespace DataLoader
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
frmMain.AddError(ex, "Save Section");
|
||||
log.Error("Save Section");
|
||||
log.ErrorFormat("oldstepsequence = {0}", stpseq);
|
||||
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
|
||||
@@ -182,12 +183,13 @@ namespace DataLoader
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
frmMain.AddError(ex, "OldToNew {0}", lkup);
|
||||
Console.WriteLine(string.Format("Error in oldtonew {0}", lkup));
|
||||
Console.WriteLine(string.Format("Error = {0}", ex.Message));
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private int GetDocStyleIndx(string dstyleindx, FormatInfo format, Item procitem, DocVersion docver)
|
||||
private int GetDocStyleIndx(string dstyleindx, FormatInfo format, Item procitem, DocVersion docver, string Number, string Title)
|
||||
{
|
||||
// get the format, if format is set, use it, otherwise walk
|
||||
if (format == null)
|
||||
@@ -199,7 +201,9 @@ namespace DataLoader
|
||||
{
|
||||
if ((ds.OldToNew & docstyle)>0) return (int)ds.Index;
|
||||
}
|
||||
return 0;
|
||||
frmMain.AddError("Bad OldToNew Document Style {0}:{1} dStyleIndex = '{2}'\r\n{3} - Missing OldToNew {4}",
|
||||
procitem.DisplayNumber, (Number ?? "") == "" ? Title : Number, dstyleindx, format, docstyle);
|
||||
return 0; // Default is Zero
|
||||
}
|
||||
private FormatInfo GetFormat(Item procitem, DocVersion docver)
|
||||
{
|
||||
@@ -255,7 +259,8 @@ namespace DataLoader
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.ErrorFormat("Error getting long section title {0}", ex.Message);
|
||||
frmMain.AddError(ex, "Error getting long section title");
|
||||
log.ErrorFormat("Error getting long section title {0}", ex.Message);
|
||||
}
|
||||
da.Dispose();
|
||||
}
|
||||
@@ -532,6 +537,8 @@ namespace DataLoader
|
||||
LoadSection(ds, da, FileName);// Try Again
|
||||
break;
|
||||
default: // Unrecognized error
|
||||
frmMain.AddError(ex, "Unrecognized error in LoadSection {0}", FileName);
|
||||
Console.WriteLine("Unrecognized error: error = {0}", ex.Message);
|
||||
log.ErrorFormat("File - {0}.DBF\r\n\r\n{1}\r\n\r\n{2}", FileName, ex.Message, ex.InnerException);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user