library functions to throw exceptions