Analyze errors and return precise error messages
(self, code: str, error_msg: str)
| 30 | } |
| 31 | |
| 32 | def analyze_error(self, code: str, error_msg: str) -> Dict: |
| 33 | """Analyze errors and return precise error messages""" |
| 34 | error_info = { |
| 35 | "error_type": None, |
| 36 | "line_number": None, |
| 37 | "column": None, |
| 38 | "problematic_code": None, |
| 39 | "context_lines": [], |
| 40 | "suggested_fix": None, |
| 41 | "fix_scope": "single_line", |
| 42 | "relevant_code_block": None, |
| 43 | } |
| 44 | |
| 45 | # Parse the error message |
| 46 | error_info.update(self._parse_error_message(error_msg)) |
| 47 | |
| 48 | # Conduct specific analysis based on the type of error |
| 49 | if error_info["error_type"] in self.common_manim_errors: |
| 50 | analyzer = self.common_manim_errors[error_info["error_type"]] |
| 51 | error_info.update(analyzer(code, error_msg, error_info)) |
| 52 | |
| 53 | # Extract the relevant code blocks |
| 54 | error_info["relevant_code_block"] = self._extract_relevant_code_block(code, error_info) |
| 55 | return error_info |
| 56 | |
| 57 | def _parse_error_message(self, error_msg: str) -> Dict: |
| 58 | """Parse the error message and extract basic information""" |
no test coverage detected