Catch common error in salt.function and warn and correct

Closes #17190