Jump to content

Exceptions: Difference between revisions

no edit summary
(extended task to include trowing an exception)
No edit summary
Line 56:
}
}
 
==[[C#]]==
'''Compiler''': MSVS 2005
 
public class MyException : Exception
{
// data with info about exception
};
void foo()
{
throw MyException();
}
void call_foo()
{
try {
foo();
}
catch (MyException e)
{
// handle exceptions of type MyException and derived
}
catch
{
// handle any type of exception not handled by above catches
}
}
 
==[[Python]]==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.