Skip to content

Commit 5bc3af3

Browse files
authored
Merge pull request #75 from messerli-informatik-ag/exception-recommendation
Recommend `ArgumentException` over `NotImplementedException`
2 parents 5a008b3 + 16e8d00 commit 5bc3af3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

documentation/src/basic-constructs.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ foreach (var value in values.OrderByDescending(v => v))
5656
## Switch-statement
5757

5858
### Handle all cases
59-
60-
Unhandled cases lead the program into an undefined state. If you have no natural default case, declare one throwing a [System.NotImplementedException].
61-
62-
[System.NotImplementedException]: https://docs.microsoft.com/en-us/dotnet/api/system.notimplementedexception
59+
Unhandled cases lead the program into an undefined state.
60+
If you have no natural default case, declare one throwing an [`ArgumentException`] when dealing with an argument or an [`InvalidOperationException`] for all other cases.
6361

6462
## Goto
65-
6663
The goto statement is forbidden in all cases.
64+
65+
66+
[`ArgumentException`]: https://docs.microsoft.com/en-us/dotnet/api/system.argumentexception
67+
[`InvalidOperationException`]: https://docs.microsoft.com/en-us/dotnet/api/system.invalidoperationexception

0 commit comments

Comments
 (0)