What is the general rule of thumb when deciding whether to add a throws
clause to a method or using a try-catch
?
From what I've read myself, the throws
should be used when the caller has broken their end of the contract (passed object) and the try-catch
should be used when an exception takes place during an operation that is being carried out inside the method. Is this correct? If so, what should be done on the callers side?
P.S: Searched through Google and SO but would like a clear answer on this one.