Move rescue out of factorial method
because factorial method needs to stop once exception is raised