JetBrains Rider 2017.3 Help

Code Inspection: Empty general catch clause

Consider the following code snippet:

string text = ""; try { text = File.ReadAllText("test.txt"); } catch { }

In the snippet above, the catch clause catches absolutely all errors. Since a non-response to an exception is a fairly rare (and potentially dangerous) thing, JetBrains Rider warns about this and offers to catch an Exception. There are, however, usages of a catch-all statement that are justified.

Last modified: 19 April 2018

See Also