Generalized functions and handle exceptions