Test for exception class rather than message

Exception behavior seemed to differ on os x.