Is there a way to automatically generate a "catch" for all possible exceptions that the method can use in vs 2010 or in a third-party application?
For example, if I use "Directory.CreateDirectory", it will automatically create:
try { Directory.CreateDirectory("blabla"); } catch (PathTooLongException) {} catch (DirectoryNotFoundException) {} catch (IOException) {} catch (ArgumentNullException) {} catch (UnauthorizedAccessException) {}
There is a tool that finds unhandled exceptions in your code: Hunter Exception using Red Gate software .
As it turned out, they stopped it:
.NET 4.0 WPF , CLR, . , CLR. , , Exception Hunter , , .
, " , " . , catch-all
try { ... } catch (Exception ex) { logAndShowErrorMessage(ex); }
(WinForms) (WPF: Application.DispatcherUnhandledException, WebForms: Application.Error).
, , , , .
: , , Java, " ": , , . , # :
- , , , . , , , # one , ( , , Java).
, catch(Exception), , Exception. , , , ? ( ) , - , , (, , Directory.CreateDirectory , , , , .
catch(Exception)
Exception
Directory.CreateDirectory