Skip to content

Commit a824bcc

Browse files
authored
Merge pull request #3 from Probely/api-error-exposure
Expose API errors on workflow
2 parents 99a5c05 + 02eb8a8 commit a824bcc

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

scan.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,17 @@ def scan(api_key: str, target_id: str, base_url: str, scan_profile: str):
2424
json={"scan_profile": scan_profile} if scan_profile else {},
2525
headers={"Authorization": f"JWT {api_key}"},
2626
)
27-
response.raise_for_status()
27+
try:
28+
response.raise_for_status()
29+
30+
except requests.HTTPError:
31+
print("Received error from Probely's API when starting the scan:")
32+
print(f"Status code: {response.status_code}")
33+
print(f"Content: {response.content.decode()}")
34+
exit(1)
35+
36+
else:
37+
print("Scan started successfully.")
2838

2939

3040
if __name__ == "__main__":

0 commit comments

Comments
 (0)