I was under the impression that Exception is good for catching all possible exceptions since every one of them has Exception as a base class. Then while developing an Android app I used the following method which in some custom ROMs has been removed.
boolean result = false;
try{
result = Settings.canDrawOverlays(context);
}
catch(Exception e){
Log.e("error","error");
}
However this did not catch the exception thrown. Later I used NoSuchMethodError
instead of Exception
and then the exception was caught.
Can someone explain why this is happening ?