Create error instances with a code