Replace Result with error_code