I have custom exception which extends JSONException and i want my method to throw this exception rather than using try catch in my method.
When i use my exception, IDE still warning me to handle JSON exception.
Exception
public class NoBorderException extends JSONException { public NoBorderException(String s) { super(s); } public String getMessage(){ return super.getMessage(); } } Method - unhandled JSON exception
private void loadNeighboringCountries(String data) throws NoBorderException { final JSONArray arrBorders = new JSONArray(data); System.out.print(arrBorders.get(0)); Method - No problem
private void loadNeighboringCountries(String data) throws JSONException{ final JSONArray arrBorders = new JSONArray(data); System.out.print(arrBorders.get(0)); Thanks,