how to catch the exceptions