@@ -193,7 +193,7 @@ async def validate_scan_configuration(
193193 profile_ids = [p .get ("id" ) for p in profiles if p .get ("id" )]
194194 if validation_request .profile_id not in profile_ids :
195195 raise HTTPException (status_code = 400 , detail = "Profile not found in SCAP content" )
196- except :
196+ except Exception :
197197 raise HTTPException (status_code = 400 , detail = "Invalid SCAP content profiles" )
198198
199199 # Resolve credentials
@@ -366,7 +366,7 @@ async def quick_scan(
366366 status_code = 400 ,
367367 detail = "No profiles available in SCAP content" ,
368368 )
369- except :
369+ except Exception :
370370 raise HTTPException (status_code = 400 , detail = "Invalid SCAP content profiles" )
371371
372372 # Generate scan name
@@ -468,7 +468,7 @@ async def quick_scan(
468468 if len (parts ) == 2 :
469469 avg_minutes = (int (parts [0 ]) + int (parts [1 ])) / 2
470470 estimated_time = datetime .utcnow ().timestamp () + (avg_minutes * 60 )
471- except :
471+ except Exception :
472472 logger .debug ("Ignoring exception during cleanup" )
473473
474474 return QuickScanResponse (
@@ -1038,18 +1038,14 @@ async def create_scan(
10381038 profiles = []
10391039 if content_result .profiles :
10401040 try :
1041- import json
1042-
10431041 profiles = json .loads (content_result .profiles )
10441042 profile_ids = [p .get ("id" ) for p in profiles if p .get ("id" )]
10451043 if scan_request .profile_id not in profile_ids :
10461044 raise HTTPException (status_code = 400 , detail = "Profile not found in SCAP content" )
1047- except :
1045+ except Exception :
10481046 raise HTTPException (status_code = 400 , detail = "Invalid SCAP content profiles" )
10491047
10501048 # Create scan record with UUID primary key
1051- import json
1052-
10531049 scan_id = str (uuid .uuid4 ())
10541050 db .execute (
10551051 text (
@@ -1122,7 +1118,7 @@ async def create_scan(
11221118 "error_code" : classified_error .error_code ,
11231119 },
11241120 )
1125- except :
1121+ except Exception :
11261122 # Fallback to generic error if classification fails
11271123 raise HTTPException (status_code = 500 , detail = f"Failed to create scan: { str (e )} " )
11281124
@@ -1159,10 +1155,8 @@ async def get_scan(
11591155 scan_options = {}
11601156 if result .scan_options :
11611157 try :
1162- import json
1163-
11641158 scan_options = json .loads (result .scan_options )
1165- except :
1159+ except Exception :
11661160 logger .debug ("Ignoring exception during cleanup" )
11671161
11681162 scan_data = {
@@ -1775,7 +1769,7 @@ async def create_verification_scan(
17751769 profile_ids = [p .get ("id" ) for p in profiles if p .get ("id" )]
17761770 if verification_request .profile_id not in profile_ids :
17771771 raise HTTPException (status_code = 400 , detail = "Profile not found in SCAP content" )
1778- except :
1772+ except Exception :
17791773 raise HTTPException (status_code = 400 , detail = "Invalid SCAP content profiles" )
17801774
17811775 # Generate scan name
0 commit comments