File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,20 +199,12 @@ def process_journals(session, args):
199199 response = session .get (url , params = params , timeout = 30 )
200200 response .raise_for_status ()
201201 data = response .json ()
202- except requests .exceptions .RequestException as e :
203- if hasattr (e , "response" ) and e .response .status_code == 400 :
204- LOGGER .info (f"Reached end of available data at page { page } " )
205- break
206- else :
207- LOGGER .error (f"Failed to fetch journals page { page } : { e } " )
208- raise shared .QuantifyingException (
209- f"Critical API error on page { page } : { e } " , exit_code = 1
210- )
211- except (ValueError , KeyError ) as e :
212- LOGGER .error (f"Failed to parse JSON response on page { page } : { e } " )
213- raise shared .QuantifyingException (
214- f"Critical JSON parsing error on page { page } : { e } " , exit_code = 1
215- )
202+ except requests .HTTPError as e :
203+ raise shared .QuantifyingException (f"HTTP Error: { e } " , 1 )
204+ except requests .RequestException as e :
205+ raise shared .QuantifyingException (f"Request Exception: { e } " , 1 )
206+ except KeyError as e :
207+ raise shared .QuantifyingException (f"KeyError: { e } " , 1 )
216208
217209 try :
218210 results = data .get ("results" , [])
You can’t perform that action at this time.
0 commit comments