Skip to content

Instantly share code, notes, and snippets.

@tdmitch
Created December 15, 2016 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdmitch/1066e394569a6b19dc6d86db6f9c1f48 to your computer and use it in GitHub Desktop.
Save tdmitch/1066e394569a6b19dc6d86db6f9c1f48 to your computer and use it in GitHub Desktop.
// If error, write to log and fail
if (
// Error conditions:
(!(Dts.Variables["vExitCode"].Value.ToString() == "0")) // If exit code = 0
|| exceptionTxt.Length > 0 // Or an exception was captured above
|| Dts.Variables["vStdError"].Value.ToString().Length > 0 // Or StdError was captured above
)
{
string err1 = Dts.Variables["vStdError"].Value.ToString();
string err2 = exceptionTxt;
string errFinal = "";
if (err1 != null)
{
errFinal += err1.Trim() + System.Environment.NewLine;
}
if (err2 != null)
errFinal += err2.Trim();
Dts.Events.FireError(0, "7Zip Error", errFinal, string.Empty, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment