I want to know how does one know to create and throw a checked exception or an unchecked exception.
For example I have a service which takes some data and validates it before using it. During validation a certain field did not meet the rules and I want to throw an exception say ValidationException(). How will I know of decide it should be checked or unchecked.
In another case I am calling an external web service from my code for example the google stock api. Let's assume i have a timeout of 3 seconds. If the time exprires i want to throw an exception say BackendException(). How will I know if it should be a checked exception or an unchecked exception.
Thanks in advance.