MCPcopy Index your code
hub / github.com/showlab/Code2Video / analyze_error

Method analyze_error

src/scope_refine.py:32–55  ·  view source on GitHub ↗

Analyze errors and return precise error messages

(self, code: str, error_msg: str)

Source from the content-addressed store, hash-verified

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"""

Callers 1

fix_code_smartMethod · 0.80

Calls 2

_parse_error_messageMethod · 0.95

Tested by

no test coverage detected