I have some code like this in C# and npgsql and I do not get an idea how to handle the situation, if OpenConnectionAsync() fails.
var dataSource = NpgsqlDataSource.Create(dbConnectionString);
await dataSource.OpenConnectionAsync();
Something like try { await … ] catch() does not work.
Everthing below the await statement is not executed anymore in case of an error …
New contributor
Marten Feldtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.