I am currently writing a winforms application (C #).
I use the Enterprise Library Exception Handler, following a fairly standard approach to what I see. IE: In the main Program.cs method, I connected an event handler to the Application.ThreadException event, etc.
This approach works well and handles exceptional application circumstances.
In one of my business objects, I throw various exceptions in the Set accessor of one of the object properties
set {
if (value > MaximumTrim)
throw new CustomExceptions.InvalidTrimValue("The value of the minimum trim...");
if (!availableSubMasterWidthSatisfiesAllPatterns(value))
throw new CustomExceptions.InvalidTrimValue("Another message...");
_minimumTrim = value;
}
( " " ) , - - , . , , ( , ..), , , , - , : , -. , , .
, , Application.ThreadException, , .
Application.ThreadException, "... , ". - ? .
, : explicity , Application.ThreadException. , Enterprise Library. , , catch, , "" .
try
{
if (value > MaximumTrim)
throw new CustomExceptions.InvalidTrimValue("The value of the minimum...");
if (!availableSubMasterWidthSatisfiesAllPatterns(value))
throw new CustomExceptions.InvalidTrimValue("Another message");
_minimumTrim = value;
}
catch (Exception ex)
{
Program.ThreadExceptionHandler.ProcessUnhandledException(ex);
}
AppDomain.UnhandledException, .
, - , . , , try catch, , ?