There are a couple of restrictions that can be applied to exceptions. We can restrict a type of exception to be thrown and we can also restrict a function to throw an exception.
Syntax of restrictions to an exception:
return_type function_name(arguments_list) throw(type_list)
For Example, this function can only throw int and char:
void Exception(int case) throw(int, char)
if(case==0) throw case;
if(case==1) throw ‘m’;