Use a custom error_code for the term system and improve error code generation.