Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion backend/code_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def __init__(self, code):
except SyntaxError as e:
logging.error(f"SyntaxError: {e}")
raise
except Exception as e:
logging.error(f"Unexpected error in CodeParser constructor: {e}")
raise

def find_functions(self):
return [node.name for node in ast.walk(self.tree) if isinstance(node, ast.FunctionDef)]
Expand Down Expand Up @@ -65,6 +68,9 @@ def verify_database_connection(self):
sample_code = "def example():\n return True"
parser = CodeParser(sample_code)
analysis = parser.analyze_code()
parser.save_analysis_to_db("sample_code.py", "Code Analysis", str(analysis), None)
try:
parser.save_analysis_to_db("sample_code.py", "Code Analysis", str(analysis), None)
except Exception as e:
logging.error(f"Unexpected error in save_analysis_to_db: {e}")
parser.verify_database_connection()
print(analysis)
3 changes: 3 additions & 0 deletions backend/pipeline_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def autogpt_task(self, task):
max_tokens=150
)
return response.choices[0].text.strip()
except openai.error.AuthenticationError as e:
logging.error(f"API key error during autogpt_task: {e}")
return "API key error"
except Exception as e:
logging.error(f"Error during autogpt_task: {e}")
return ""
Expand Down
2 changes: 1 addition & 1 deletion database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def verify_component_connections():

# Check modules components
if not all([AlertsNotifications, APTSimulation]):
raise ValueError("Modules component connection check failed")
raise ValueError("Modules components connection check failed")
logging.info("Modules components connection verified.")

except Exception as e:
Expand Down
Loading