code for the exceptions