handling the exceptions