Skip to content

Commit

Permalink
fix(engine_dependencies): ✅ Handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
ssantaa9 committed Sep 2, 2024
1 parent a7d1bff commit d1590ce
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,18 @@ def scan_dependencies(self, prefix, cwd, mode, to_scan):
scan_result = json.loads(result.stdout)
else:
scan_result = {}
file_result = os.path.join(os.getcwd(), "scan_result.json")
with open(file_result, "w") as file:
json.dump(scan_result, file, indent=4)
if any(
word in result.stderr
for word in ["What went wrong", "Caused by"]
):
logger.error(f"Error executing Xray scan: {result.stderr}")
return None
if result.stdout == "null\n":
logger.warning(f"Xray scan returned null: {result.stderr}")
return None
file_result = os.path.join(os.getcwd(), "scan_result.json")
with open(file_result, "w") as file:
json.dump(scan_result, file, indent=4)
return file_result
else:
logger.error(f"Error executing Xray scan: {result.stderr}")
Expand Down

0 comments on commit d1590ce

Please sign in to comment.