Added try/catch for 'Demo data' project for error cases

This commit is contained in:
KharchenkoVV 2021-09-07 17:39:28 +05:00
parent 42b9849ae9
commit 9d80c28c1b

View File

@ -18,6 +18,8 @@ namespace AsbCloudDbDemoData
return; return;
} }
try
{
var options = new DbContextOptionsBuilder<AsbCloudDbContext>() var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True") .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
.Options; .Options;
@ -297,5 +299,10 @@ namespace AsbCloudDbDemoData
else else
Console.WriteLine("Ошибка при добавлении данных"); Console.WriteLine("Ошибка при добавлении данных");
} }
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
} }
} }