Use correct exception type (fix tests)