$class will be false here on failure, resulting in a not helpful error message.