factorial exception handling