Fix autogenerate raise exception