SalesForceBackup/ConsoleErrorHandler.cs
/// <summary>
/// Handles error logging for the console application.
/// </summary>
/// <param name="e">The exception to handle.</param>
/// <param name="exitCode">Optionally, the error code to return to the console. Defaults to -1 (unknown).</param>
/// <param name="errorMessage">Optionally, a descriptive error message to return to the console.</param>
/// <remarks>This will terminate the application with the specified exit code.</remarks>
Handles error logging for the console application.
Handles error logging for the console application .
public void HandleError(Exception e, int exitCode, string errorMessage)
        {
            Console.WriteLine(errorMessage);
            Console.WriteLine(e.ToString());
            Environment.Exit(exitCode);
        }
public void HandleError ( Exception e , int exitCode , string errorMessage ) { Console . WriteLine ( errorMessage ) ; Console . WriteLine ( e . ToString ( ) ) ; Environment . Exit ( exitCode ) ; }
Handles error logging for the console application.
Handles error logging for the console application .
e
Exception
The exception to handle.
The exception to handle .
exitCode
int
Optionally, the error code to return to the console. Defaults to -1 (unknown).
Optionally the error code to return to the console . Defaults to - 1 ( unknown ) .
errorMessage
string
Optionally, a descriptive error message to return to the console.
Optionally a descriptive error message to return to the console .
remarks
This will terminate the application with the specified exit code.
This will terminate the application with the specified exit code .