try { foo.fail() } catch(Exception e) { // handle any type of exception };