refactor(errors): replace silent exception handling in console and server
This commit is contained in:
1 parent
41deb48005
commit
c76c9bb7e8
20 files changed
+267
-107
No files matched your search
@@ -13,9 +13,12 @@
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ModelService:
|
||||
"""Service handling agent architecture profile detection and metadata formatting."""
|
||||
@@ -44,8 +47,10 @@ class ModelService:
|
||||
elif llm_cfg and llm_cfg.default:
|
||||
provider = str(llm_cfg.default.provider)
|
||||
model_id = str(llm_cfg.default.model)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as exc:
|
||||
# Unreadable/invalid LLM config: fall back to display defaults
|
||||
# (cached for the TTL, so this logs at most once per window).
|
||||
logger.warning("Could not resolve LLM config for display: %s", exc)
|
||||
cls._llm_info_cache = (now, provider, model_id)
|
||||
return provider, model_id
|
||||
|
||||
@@ -94,7 +99,8 @@ class ModelService:
|
||||
return "pro"
|
||||
elif "flash" in p_str:
|
||||
return "flash"
|
||||
except Exception:
|
||||
except (ValueError, TypeError):
|
||||
# Malformed device_info JSON: try the other profile sources.
|
||||
pass
|
||||
|
||||
if (row_dict.get("status") == "running") and running_profile:
|
||||
@@ -132,7 +138,8 @@ class ModelService:
|
||||
for x in ("planner", "validator", "operator", "checker")
|
||||
):
|
||||
return "pro"
|
||||
except Exception:
|
||||
except (ValueError, TypeError):
|
||||
# Malformed trace payload JSON: skip this trace.
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
Reference in new issue
Block a user