mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(backend): tighten ValueError message and test assertion in _generate_schema
- Add stable prefix to ValueError: "Invalid graph schema input: {e}"
to aid debugging and triage
- Add match="name" to pytest.raises to guard the specific missing-name
failure path, not just any ValueError
This commit is contained in:
@@ -355,7 +355,7 @@ class BaseGraph(GraphBaseMeta):
|
||||
"required": [p.name for p in schema_fields if p.value is None],
|
||||
}
|
||||
except AttributeError as e:
|
||||
raise ValueError(str(e)) from e
|
||||
raise ValueError(f"Invalid graph schema input: {e}") from e
|
||||
|
||||
|
||||
class GraphTriggerInfo(BaseModel):
|
||||
|
||||
@@ -1477,5 +1477,5 @@ def test_generate_schema_raises_value_error_when_name_missing():
|
||||
and re-raised as ValueError so the existing 400 handler in rest_api.py fires
|
||||
instead of falling through to the 500 catch-all.
|
||||
"""
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(ValueError, match="name"):
|
||||
GraphModel._generate_schema((AgentInputBlock.Input, {}))
|
||||
|
||||
Reference in New Issue
Block a user