use of is instance instead of exception