Yes, that's legal. As ouster said, one way to deal with it is to put the inner try-catch block in its own function and call that function from your outer try-catch block.
Another way to handle it is with multiple catch blocks.
void f()
{
try
{
//Some code that throws ExceptionA
//Some code that throws ExceptionB
}
catch(ExceptionA ea)
{
//Some exception handling
}
catch(ExceptionB eb)
{
//Some exception handling
}
}//f
The thing to be careful of here is the specificity of the exception types in your catch blocks. If ExceptionB extends ExceptionA in the example above, then the ExceptionB block would never get called because any ExceptionB that gets thrown would be handled by the ExceptionA block. You have to order the catch blocks in most specific to least specific order when dealing with Exception class hierarchies.