refactor(ai_client): narrow 'except:' to specific types in _classify_deepseek/minimax_error (Phase 9 sites 1+2)

The bare 'except:' in _classify_deepseek_error (L332) and _classify_minimax_error (L355)
was classified as INTERNAL_BROAD_CATCH. Narrowed to 'except (ValueError, AttributeError)'
since the only realistic exceptions from exc.response.json() are JSONDecodeError (subclass of ValueError)
and AttributeError (if exc.response is None or .json() is missing).
This commit is contained in:
ed
2026-06-20 11:00:59 -04:00
parent 57ae4ce40a
commit d8d5089271
+2 -2
View File
@@ -329,7 +329,7 @@ def _classify_deepseek_error(exc: Exception, source: str = "ai_client.deepseek")
err_data = exc.response.json() err_data = exc.response.json()
if "error" in err_data: body = str(err_data["error"].get("message", exc.response.text)) if "error" in err_data: body = str(err_data["error"].get("message", exc.response.text))
else: body = exc.response.text else: body = exc.response.text
except: except (ValueError, AttributeError):
body = exc.response.text body = exc.response.text
else: else:
body = str(exc) body = str(exc)
@@ -352,7 +352,7 @@ def _classify_minimax_error(exc: Exception, source: str = "ai_client.minimax") -
err_data = exc.response.json() err_data = exc.response.json()
if "error" in err_data: body = str(err_data["error"].get("message", exc.response.text)) if "error" in err_data: body = str(err_data["error"].get("message", exc.response.text))
else: body = exc.response.text else: body = exc.response.text
except: except (ValueError, AttributeError):
body = exc.response.text body = exc.response.text
else: else:
body = str(exc) body = str(exc)