4
Answers

C# Exception error question

Jacob R

Jacob R

14y
2.3k
1

I'm a bit confused about this.  Would a method with a try catch block, catch the error of another method that it calls?  I'll do some example code...
 

 private void methodA()
{
   try
   {
      ...do some code
      methodB();
   }
   catch (exception e)
   {
      messagebox.show(e.message);
   }
}
 
private void methodB()
{
   do some code that errors...
}

 
So will methodA display the exception.message that methodB encountered?  If not, can you explain how I would get it to?
 
Thanks
-Shifty
Answers (4)