I’m trying to call a web service that saves user information. Essentially, a ‘completion’ object is returned with the results of the service call. The code I have can be condensed as follows:
public bool SaveUserInformation(ArgsList args) {
CompletionObject results = SaveService(args);
if (results.Status == Failed)
throw SomeException("onoez D:");
return true;
}
Essentially, this method returns a boolean but the value is never false. This seems a little strange to me, so is there a better way to approach this?
Thanks!
Why not return
void? If an exception is thrown then you will know it. If it isn’t thrown, you know that your function completed successfully (returned true).If, however, you’re overriding a virtual function which returns bool then you can of course always return true, since you have to return some boolean value anyway. Come to think of it, you can return false as well 🙂