Пример #1
0
        public static int Main(string[] args)
        {
            string errMessage;

            if (!TryConfigureLogger(args, out errMessage))
            {
                ConsoleLog.WriteError($"Logger cannot be initialized: {errMessage}");
                return(1);
            }
            try
            {
                Log.Debug("++ DbUp entry point");

                int result = Run(args);
                if (result == 0)
                {
                    ConsoleLog.WriteSuccess("Succeed!");
                }
                return(0);
            }
            catch (Exception ex)
            {
                Log.Error("DbUp failed", ex);
                ConsoleLog.WriteError($"Failed\r\n{ex.Message}");
                return(1);
            }
            finally
            {
                Log.Debug("-- DbUp exit point");
            }
        }
Пример #2
0
 public static bool TryParse(string[] args, out DbOptions options)
 {
     options = null;
     try
     {
         options = Parse(args);
         return(true);
     }
     catch (FormatException formatExp)
     {
         ConsoleLog.WriteInfo(formatExp.Message);
         return(false);
     }
     catch (Exception e)
     {
         ConsoleLog.WriteError($"An unexpected error happened: {e.Message}");
         return(false);
     }
 }