I have a function that should take a string, if necessary add things there and return the result.
My natural incline is simply returning a result related to string concatenation, and if that fails, let the exception pop up to the caller. However, this function has a default value, which I simply return unchanged.
My question is: what if someone passed something unexpected to the method and it returns something that the user does not expect? The method should fail, but how to do it?
source
share