If we are using components in our application, how can we handle exceptions raised in a component
Regarding Components
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
If we are using components in our application, how can we handle exceptions raised in a component
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Scott LysleRank #49 · 31K reputationPosted Jan 10, 2009, 11:29 AM EST
Amit DhaniaRank #3,217 · 446 reputationPosted Jan 20, 2009, 2:30 AM EST
When we use components in our application, exceptions not handled at each component but at a specific section. Exception
occurred at component is thrown to next layer to next and finaly handled.
We handle exception in following in ways:
Create a class called MyException inheriting Exception class
public class MyException:Exception
{
public MyException(string msg)
: base(msg)
{
}
}
We wil use above class to handle exception flow from components to fnal layer we handle exception
Layer 3:
try{}
catch(exception ex){ throw MyException(ex.tosting());}
Layer 2:
try{}
catch(exception ex){ throw MyException(ex.tosting());}
Layer 1:
try{}
catch(exception ex){ //error handled here by creating errorlog or insert error details to database}