Created
December 1, 2016 09:47
-
-
Save kostrse/b3e923c288f66b1dc72c6702975f665f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static async Task FailsAsync(bool shouldFail) | |
{ | |
if (shouldFail) | |
throw new ApplicationException("Custom exception."); | |
await Task.CompletedTask; | |
} | |
static Task Fails(bool shouldFail) | |
{ | |
if (shouldFail) | |
throw new ApplicationException("Custom exception."); | |
return Task.CompletedTask; | |
} | |
static void Main(string[] args) | |
{ | |
try | |
{ | |
var t = FailsAsync(true); | |
//var t = Fails(true); | |
Console.WriteLine("FailsAsync() doesn't fail here."); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine("Fails() fails here."); | |
Console.WriteLine(ex.ToString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment