Parse the error message and extract basic information
(self, error_msg: str)
| 55 | return error_info |
| 56 | |
| 57 | def _parse_error_message(self, error_msg: str) -> Dict: |
| 58 | """Parse the error message and extract basic information""" |
| 59 | result = {} |
| 60 | |
| 61 | # Extract the error type |
| 62 | error_type_match = re.search(r"(\w+Error|\w+Exception)", error_msg) |
| 63 | if error_type_match: |
| 64 | result["error_type"] = error_type_match.group(1) |
| 65 | |
| 66 | # Extract the line number |
| 67 | line_match = re.search(r"line (\d+)", error_msg) |
| 68 | if line_match: |
| 69 | result["line_number"] = int(line_match.group(1)) |
| 70 | |
| 71 | # Extract the column number |
| 72 | column_match = re.search(r"column (\d+)", error_msg) |
| 73 | if column_match: |
| 74 | result["column"] = int(column_match.group(1)) |
| 75 | |
| 76 | # Extract the problematic code |
| 77 | code_match = re.search(r'File ".*?", line \d+.*?\n\s*(.*)', error_msg) |
| 78 | if code_match: |
| 79 | result["problematic_code"] = code_match.group(1).strip() |
| 80 | |
| 81 | return result |
| 82 | |
| 83 | def _analyze_name_error(self, code: str, error_msg: str, error_info: Dict) -> Dict: |
| 84 | """Analyze NameError""" |