MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / _generate_key

Method _generate_key

core/error_database.py:181–189  ·  view source on GitHub ↗

Generate unique key for error pattern.

(self, error_type: str, error_message: str)

Source from the content-addressed store, hash-verified

179 warning(f"Failed to save error database: {e}")
180
181 def _generate_key(self, error_type: str, error_message: str) -> str:
182 """Generate unique key for error pattern."""
183 # Normalize error message (remove specific paths, line numbers)
184 normalized = re.sub(r'line \d+', 'line N', error_message.lower())
185 normalized = re.sub(r'file "[^"]+"', 'file "..."', normalized)
186 normalized = re.sub(r'/[a-zA-Z0-9_/.-]+', '/...', normalized)
187
188 content = f"{error_type}:{normalized}"
189 return hashlib.sha256(content.encode()).hexdigest()[:16]
190
191 def record_error(self, error_type: str, error_message: str,
192 context: Dict = None) -> str:

Callers 1

record_errorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected