32 lines
549 B
Plaintext
Raw Permalink Normal View History

2023-06-12 09:22:59 +02:00
include::../why.adoc[]
2023-06-12 09:22:59 +02:00
[source,csharp,diff-id=1,diff-type=noncompliant]
2020-06-30 12:47:33 +02:00
----
try
{
2023-06-12 09:22:59 +02:00
// Some work which end up throwing an exception
2020-06-30 12:47:33 +02:00
throw new ArgumentException();
2023-06-12 09:22:59 +02:00
}
2020-06-30 12:47:33 +02:00
finally
{
2023-06-12 09:22:59 +02:00
// Cleanup
throw new InvalidOperationException(); // Noncompliant: will mask the ArgumentException
2020-06-30 12:47:33 +02:00
}
----
2023-06-12 09:22:59 +02:00
[source,csharp,diff-id=1,diff-type=compliant]
2020-06-30 12:47:33 +02:00
----
2023-06-12 09:22:59 +02:00
try
2020-06-30 12:47:33 +02:00
{
2023-06-12 09:22:59 +02:00
// Some work which end up throwing an exception
2020-06-30 12:47:33 +02:00
throw new ArgumentException();
2023-06-12 09:22:59 +02:00
}
2020-06-30 12:47:33 +02:00
finally
{
2023-06-12 09:22:59 +02:00
// Cleanup without throwing
2020-06-30 12:47:33 +02:00
}
----
2023-06-12 09:22:59 +02:00
include::../resources-dotnet.adoc[]
2023-06-12 09:22:59 +02:00
include::../rspecator.adoc[]