(self)
Processes and re-raises the last mujoco.wrapper.Error caught.

    This function will insert the relevant line from the source XML to the error
    message. If debug mode is enabled, additional debugging information is
    appended to the error message. If debug mode is not enabled, the error
    message instructs the user to enable it by rerunning the executable with an
    appropriate flag.
Processes and re-raises the last mujoco.wrapper.Error caught.
Processes and re - raises the last mujoco . wrapper . Error caught .
def process_and_raise_last_exception(self):
    """Processes and re-raises the last mujoco.wrapper.Error caught.

    This function will insert the relevant line from the source XML to the error
    message. If debug mode is enabled, additional debugging information is
    appended to the error message. If debug mode is not enabled, the error
    message instructs the user to enable it by rerunning the executable with an
    appropriate flag.
    """
    err_type, err, tb = sys.exc_info()
    line_number_match = re.search(r'[Ll][Ii][Nn][Ee]\s*[:=]?\s*(\d+)', str(err))
    if line_number_match:
      xml_line_number = int(line_number_match.group(1))
      xml_line = self._xml_string.split('\n')[xml_line_number - 1]
      stripped_xml_line = xml_line.strip()
      comment_match = re.search(_DEBUG_METADATA_TAG_PREFIX, stripped_xml_line)
      if comment_match:
        stripped_xml_line = stripped_xml_line[:comment_match.start()]
    else:
      xml_line = ''
      stripped_xml_line = ''

    message_lines = []
    if debug_mode():
      if get_full_dump_dir():
        self.dump_full_debug_info_to_disk()
      message_lines.extend([
          'Compile error raised by Mujoco.',
          str(err)])
      if xml_line:
        message_lines.extend([
            stripped_xml_line,
            self._generate_debug_message_from_xml_line(xml_line)])
    else:
      message_lines.extend([
          'Compile error raised by Mujoco; '
          'run again with --pymjcf_debug for additional debug information.',
          str(err)])
      if xml_line:
        message_lines.append(stripped_xml_line)

    raise err_type('\n'.join(message_lines)).with_traceback(tb)
def process_and_raise_last_exception ( self ) : err_type , err , tb = sys . exc_info ( ) line_number_match = re . search ( r'[Ll][Ii][Nn][Ee]\s*[:=]?\s*(\d+)' , str ( err ) ) if line_number_match : xml_line_number = int ( line_number_match . group ( 1 ) ) xml_line = self . _xml_string . split ( '\n' ) [ xml_line_number - 1 ] stripped_xml_line = xml_line . strip ( ) comment_match = re . search ( _DEBUG_METADATA_TAG_PREFIX , stripped_xml_line ) if comment_match : stripped_xml_line = stripped_xml_line [ : comment_match . start ( ) ] else : xml_line = '' stripped_xml_line = '' message_lines = [ ] if debug_mode ( ) : if get_full_dump_dir ( ) : self . dump_full_debug_info_to_disk ( ) message_lines . extend ( [ 'Compile error raised by Mujoco.' , str ( err ) ] ) if xml_line : message_lines . extend ( [ stripped_xml_line , self . _generate_debug_message_from_xml_line ( xml_line ) ] ) else : message_lines . extend ( [ 'Compile error raised by Mujoco; ' 'run again with --pymjcf_debug for additional debug information.' , str ( err ) ] ) if xml_line : message_lines . append ( stripped_xml_line ) raise err_type ( '\n' . join ( message_lines ) ) . with_traceback ( tb )