Move error gen to new method