Extract error context information
(self, error_msg: str)
| 311 | return error_type, error_category, suggestions |
| 312 | |
| 313 | def extract_error_context(self, error_msg: str) -> Dict[str, Any]: |
| 314 | """Extract error context information""" |
| 315 | context = {"line_number": None, "error_line": None, "traceback": error_msg, "specific_error": None} |
| 316 | |
| 317 | # Extract line number |
| 318 | line_match = re.search(r"line (\d+)", error_msg) |
| 319 | if line_match: |
| 320 | context["line_number"] = int(line_match.group(1)) |
| 321 | |
| 322 | # Extract specific error information |
| 323 | lines = error_msg.split("\n") |
| 324 | for line in reversed(lines): |
| 325 | if line.strip() and not line.startswith(" "): |
| 326 | context["specific_error"] = line.strip() |
| 327 | break |
| 328 | |
| 329 | return context |
| 330 | |
| 331 | def validate_code_syntax(self, code: str) -> Tuple[bool, Optional[str]]: |
| 332 | """Validate code syntax correctness""" |
no outgoing calls
no test coverage detected