stores error code in ERR to preserve