Catching different types of exceptions