Helper function for the checkarg function, called in cases the argument does not pass the check. Throws an exception if stopIfNot is TRUE.
Useful links