Skip to content

Commit

Permalink
feat: added error trapping logic to show error with sql connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaxelr committed Dec 24, 2019
1 parent 716b4b5 commit 7032ff8
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/Minimig/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,28 @@ private static void Run(string[] args)
{
var cmd = TryParseArgs(args, out Options options);

switch (cmd)
try
{
case Command.RunMigrations:
var result = Migrator.RunOutstandingMigrations(options);
if (!result.Success)
Environment.Exit(1);
break;
switch (cmd)
{
case Command.RunMigrations:
var result = Migrator.RunOutstandingMigrations(options);
if (!result.Success)
Environment.Exit(1);
break;

case Command.GetCount:
int count = Migrator.GetOutstandingMigrationsCount(options);
Console.WriteLine($"{count} outstanding migrations");
Console.WriteLine();
break;
case Command.GetCount:
int count = Migrator.GetOutstandingMigrationsCount(options);
Console.WriteLine($"{count} outstanding migrations");
Console.WriteLine();
break;
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine();
Environment.Exit(1);
}

Environment.Exit(0);
Expand Down

0 comments on commit 7032ff8

Please sign in to comment.