| || |
Custom Exception Handling
I need want to a have my own exception handling function which i can add for every except statement....n there by when an exception occurs,the control should pass to that function and should excecute teh corresponding action for a particulatr exception.......for now i have 3 types of exceptions that can take place in the site that im testing.......plz let me know what kind of an approach i need to take and also plz help me wth teh code.
Re: Custom Exception Handling
you can declare a constant of some type and then in your function, which will accept your constant or something like a enum, will do certain actions based on the input param.
for example you can do something like this
<font class="small">Code:</font><hr /><pre>
myExcept = "FirstDo"
myExcept = "SecondDo"
void ExceptHandler (string sStr)
if (sStr == "FirstDo")
print ("This is first do exception handler")
else if (sStr == "SecondDo")
print ("This is second do exception handler")
print ("unknown exception occured")
I'm sure that there are other ways to solve this problem, but this is the first idea that popped into my head.
Hope this helps.